PTHREAD_CANCEL_DEFERRED

Kostik Belousov kostikbel at gmail.com
Mon Aug 16 08:20:27 UTC 2010


On Mon, Aug 16, 2010 at 11:53:52AM +0000, David Xu wrote:
> Kostik Belousov wrote:
> 
> >Missed this, thank you for pointing it out. Updated patch is at
> >http://people.freebsd.org/~kib//misc/cancel_defer.2.patch
> 
> I found SIGCANCEL is masked by
> thr_cancel_deferred(THR_CANCEL_DEFERRED_ENABLE), issignal() does not
> return the masked signal, so how a cancellation point syscall can be
> interrupted by SIGCANCEL ? I think if a thread being canceled calls
> msleep(PCATCH), it should find the signal and return EINTR.
> 
Yes, for EINTR and ERESTART case, the thread should be canceled.
Please look at the check_cancel() helper that is called at the syscall
entry and before return. If the check_cancel() decided that the syscall
is cancellation point and the thread in the deferred cancel mode, and
EINTR or ERESTART is supplied as error code, then SIGCANCEL is removed
from the thread signal mask. It is restored in the mask by ast().
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-threads/attachments/20100816/07b68d83/attachment.pgp


More information about the freebsd-threads mailing list