From a50745ec922a917513029f3f87bf820827b43f29 Mon Sep 17 00:00:00 2001 From: rpj Date: Thu, 14 Aug 2003 08:53:17 +0000 Subject: Reuse of thread IDs, improved thread ID validation, new tests, bug fixes. --- pthread_cancel.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'pthread_cancel.c') 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; -- cgit v1.2.3