diff options
-rw-r--r-- | include/pthread.h | 2 | ||||
-rw-r--r-- | lib/libc_r/uthread/uthread_detach.c | 13 | ||||
-rw-r--r-- | lib/libkse/thread/thr_detach.c | 13 | ||||
-rw-r--r-- | lib/libpthread/thread/thr_detach.c | 13 |
4 files changed, 10 insertions, 31 deletions
diff --git a/include/pthread.h b/include/pthread.h index e3a344e..b196662 100644 --- a/include/pthread.h +++ b/include/pthread.h @@ -193,7 +193,7 @@ int pthread_cond_timedwait __P((pthread_cond_t *, int pthread_cond_wait __P((pthread_cond_t *, pthread_mutex_t *)); int pthread_create __P((pthread_t *, const pthread_attr_t *, void *(*start_routine) (void *), void *)); -int pthread_detach __P((pthread_t *)); +int pthread_detach __P((pthread_t)); int pthread_equal __P((pthread_t, pthread_t)); void pthread_exit __P((void *)); void *pthread_getspecific __P((pthread_key_t)); diff --git a/lib/libc_r/uthread/uthread_detach.c b/lib/libc_r/uthread/uthread_detach.c index c8f312c..a9f2469 100644 --- a/lib/libc_r/uthread/uthread_detach.c +++ b/lib/libc_r/uthread/uthread_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: */ diff --git a/lib/libkse/thread/thr_detach.c b/lib/libkse/thread/thr_detach.c index c8f312c..a9f2469 100644 --- a/lib/libkse/thread/thr_detach.c +++ b/lib/libkse/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: */ 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: */ |