diff options
Diffstat (limited to 'lib/libpthread/thread/thr_cancel.c')
-rw-r--r-- | lib/libpthread/thread/thr_cancel.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/lib/libpthread/thread/thr_cancel.c b/lib/libpthread/thread/thr_cancel.c index 82ddbb8..c6df52e 100644 --- a/lib/libpthread/thread/thr_cancel.c +++ b/lib/libpthread/thread/thr_cancel.c @@ -37,15 +37,6 @@ pthread_cancel(pthread_t pthread) pthread->cancelflags |= PTHREAD_CANCELLING; break; - case PS_SUSPENDED: - /* - * This thread isn't in any scheduling - * queues; just change it's state: - */ - pthread->cancelflags |= PTHREAD_CANCELLING; - PTHREAD_SET_STATE(pthread, PS_RUNNING); - break; - case PS_SPINBLOCK: case PS_FDR_WAIT: case PS_FDW_WAIT: @@ -67,6 +58,20 @@ pthread_cancel(pthread_t pthread) PTHREAD_NEW_STATE(pthread,PS_RUNNING); break; + case PS_SUSPENDED: + if (pthread->suspended == SUSP_NO || + pthread->suspended == SUSP_YES || + pthread->suspended == SUSP_NOWAIT) { + /* + * This thread isn't in any scheduling + * queues; just change it's state: + */ + pthread->cancelflags |= + PTHREAD_CANCELLING; + PTHREAD_SET_STATE(pthread, PS_RUNNING); + break; + } + /* FALLTHROUGH */ case PS_MUTEX_WAIT: case PS_COND_WAIT: case PS_FDLR_WAIT: |