diff options
Diffstat (limited to 'pthread_cancel.c')
-rw-r--r-- | pthread_cancel.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/pthread_cancel.c b/pthread_cancel.c index 7a94d8d..a9a9009 100644 --- a/pthread_cancel.c +++ b/pthread_cancel.c @@ -94,12 +94,13 @@ pthread_cancel (pthread_t thread) int cancel_self; pthread_t self; - if (thread == NULL ) + /* This is the proper way to test thread validity. */ + result = pthread_kill(thread, 0); + if (0 != result) { - return ESRCH; + return result; } - result = 0; if ((self = pthread_self()) == NULL) { return ENOMEM; |