read/write etc. shall be signal-safe, and take cancel_lock, so we have to
defer signal delivery while holding cancel_lock.
Reported-by: Brent Baccala <cosine@freesoft.org> 's Claude assistant
/* We're almost done. Remove the unblock hook, restore the previous
cancellation type, and check for a pending cancellation request. */
+ HURD_CRITICAL_BEGIN;
__pthread_mutex_lock (&self->cancel_lock);
self->cancel_hook = NULL;
self->cancel_hook_arg = NULL;
cancelled = (self->cancel_state == PTHREAD_CANCEL_ENABLE)
&& self->cancel_pending;
__pthread_mutex_unlock (&self->cancel_lock);
+ HURD_CRITICAL_END;
/* Reacquire MUTEX before returning/cancelling. */
__pthread_mutex_lock (mutex);