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.
This commit is contained in:
Alexander Langer 1997-12-25 05:07:20 +00:00
parent 3b7c07b1f2
commit 372787c102
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=31985
4 changed files with 10 additions and 31 deletions

View File

@ -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));

View File

@ -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: */

View File

@ -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: */

View File

@ -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: */