summaryrefslogtreecommitdiffstats
path: root/lib/libpthread/thread/thr_detach.c
diff options
context:
space:
mode:
authoralex <alex@FreeBSD.org>1997-12-25 05:07:20 +0000
committeralex <alex@FreeBSD.org>1997-12-25 05:07:20 +0000
commit370393763bf73ce9da93cd977f866919de626f2f (patch)
treeebf81a51f33cfc5ee40812b37eeecd89a145f151 /lib/libpthread/thread/thr_detach.c
parent32ddc95d9022f09a9b44b5dec56dee6e77bb2914 (diff)
downloadFreeBSD-src-370393763bf73ce9da93cd977f866919de626f2f.zip
FreeBSD-src-370393763bf73ce9da93cd977f866919de626f2f.tar.gz
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.
Diffstat (limited to 'lib/libpthread/thread/thr_detach.c')
-rw-r--r--lib/libpthread/thread/thr_detach.c13
1 files changed, 3 insertions, 10 deletions
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: */
OpenPOWER on IntegriCloud