if (ss == _hurd_self_sigstate ()) return EINTR;
hurd_thread_cancel (thread_t thread){  struct hurd_sigstate *ss = _hurd_thread_sigstate (thread);  struct machine_thread_all_state state;  int state_change;  error_t err;  if (! ss)    return EINVAL;  __spin_lock (&ss->lock);  assert (! ss->critical_section);  ss->critical_section = 1;  err = __thread_suspend (thread);  __spin_unlock (&ss->lock);  if (! err)    {      /* Set the flag telling the thread its operation is being cancelled.  */      ss->cancel = 1;      /* Interrupt any interruptible RPC now in progress.  */      state.set = 0;      _hurdsig_abort_rpcs (ss, 0, 0, &state, &state_change, NULL, 0, 0);      if (state_change) 	err = __thread_set_state (thread, MACHINE_THREAD_STATE_FLAVOR,				  (natural_t *) &state.basic,				  MACHINE_THREAD_STATE_COUNT);      if (ss->cancel_hook)	/* The code being cancelled has a special wakeup function.	   Calling this should make the thread wake up and check the	   cancellation flag.  */	(*ss->cancel_hook) ();      __thread_resume (thread);    }  _hurd_critical_section_unlock (ss);  return err;}