diff options
| author | Daniel Eischen <deischen@FreeBSD.org> | 2004-12-18 18:07:37 +0000 |
|---|---|---|
| committer | Daniel Eischen <deischen@FreeBSD.org> | 2004-12-18 18:07:37 +0000 |
| commit | 843d4004b367db61428fa1cbf611cdbd2791d672 (patch) | |
| tree | 3341fdd3fcdb8d611509d7622be5b25f271de80a /lib/libpthread/thread/thr_cancel.c | |
| parent | 885dabe5f70ceac846c6d0623c64914d5c401f10 (diff) | |
Notes
Diffstat (limited to 'lib/libpthread/thread/thr_cancel.c')
| -rw-r--r-- | lib/libpthread/thread/thr_cancel.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/libpthread/thread/thr_cancel.c b/lib/libpthread/thread/thr_cancel.c index 8cd7acc2f6af..a6a32b8f7dc8 100644 --- a/lib/libpthread/thread/thr_cancel.c +++ b/lib/libpthread/thread/thr_cancel.c @@ -14,18 +14,26 @@ __weak_reference(_pthread_testcancel, pthread_testcancel); static inline int checkcancel(struct pthread *curthread) { - if (((curthread->cancelflags & PTHREAD_CANCEL_DISABLE) == 0) && - ((curthread->cancelflags & THR_CANCELLING) != 0)) { + if ((curthread->cancelflags & THR_CANCELLING) != 0) { /* * It is possible for this thread to be swapped out * while performing cancellation; do not allow it * to be cancelled again. */ - curthread->cancelflags &= ~THR_CANCELLING; - return (1); + if ((curthread->flags & THR_FLAGS_EXITING) != 0) { + /* + * This may happen once, but after this, it + * shouldn't happen again. + */ + curthread->cancelflags &= ~THR_CANCELLING; + return (0); + } + if ((curthread->cancelflags & PTHREAD_CANCEL_DISABLE) == 0) { + curthread->cancelflags &= ~THR_CANCELLING; + return (1); + } } - else - return (0); + return (0); } static inline void |
