From 370393763bf73ce9da93cd977f866919de626f2f Mon Sep 17 00:00:00 2001 From: alex Date: Thu, 25 Dec 1997 05:07:20 +0000 Subject: Changed pthread_detach to conform to POSIX, i.e. the single argument provided is of type pthread_t instead of pthread_t *. PR: 4320 Return EINVAL instead of ESRCH if attempting to detach an already detached thread. --- lib/libpthread/thread/thr_detach.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'lib/libpthread/thread/thr_detach.c') diff --git a/lib/libpthread/thread/thr_detach.c b/lib/libpthread/thread/thr_detach.c index c8f312c..a9f2469 100644 --- a/lib/libpthread/thread/thr_detach.c +++ b/lib/libpthread/thread/thr_detach.c @@ -36,18 +36,17 @@ #include "pthread_private.h" int -pthread_detach(pthread_t * p_pthread) +pthread_detach(pthread_t pthread) { int rval = 0; int status; pthread_t next_thread; - pthread_t pthread; /* Block signals: */ _thread_kern_sig_block(&status); /* Check for invalid calling parameters: */ - if (p_pthread == NULL || (pthread = *p_pthread) == NULL) { + if (pthread == NULL) { /* Return an invalid argument error: */ rval = EINVAL; } @@ -61,15 +60,9 @@ pthread_detach(pthread_t * p_pthread) /* Make the thread run: */ PTHREAD_NEW_STATE(next_thread,PS_RUNNING); } - - /* - * NULL the thread pointer now that the thread has been - * detached: - */ - *p_pthread = NULL; } else { /* Return an error: */ - rval = ESRCH; + rval = EINVAL; } /* Unblock signals: */ -- cgit v1.1