thr_create: new_thread_ID may be NULL

Submitted by:	avg
MFC after:	3 days
This commit is contained in:
Pawel Jakub Dawidek 2011-10-21 13:54:58 +00:00
parent 93ecaabdcb
commit 7149ddc1d3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=226615

View File

@ -76,6 +76,7 @@ static __inline int
thr_create(void *stack_base, size_t stack_size, void *(*start_func) (void*),
void *arg, long flags, thread_t *new_thread_ID)
{
pthread_t dummy;
int ret;
assert(stack_base == NULL);
@ -85,9 +86,12 @@ thr_create(void *stack_base, size_t stack_size, void *(*start_func) (void*),
pthread_attr_t attr;
pthread_attr_init(&attr);
if(flags & THR_DETACHED)
if (flags & THR_DETACHED)
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
if (new_thread_ID == NULL)
new_thread_ID = &dummy;
/* This function ignores the THR_BOUND flag, since NPTL doesn't seem to support PTHREAD_SCOPE_PROCESS */
ret = pthread_create(new_thread_ID, &attr, start_func, arg);