aboutsummaryrefslogtreecommitdiff
path: root/cddl/contrib/opensolaris/head/thread.h
diff options
context:
space:
mode:
authorPawel Jakub Dawidek <pjd@FreeBSD.org>2011-10-21 13:54:58 +0000
committerPawel Jakub Dawidek <pjd@FreeBSD.org>2011-10-21 13:54:58 +0000
commit7149ddc1d302a1d4bf92a5a82d6f46406760c4ec (patch)
tree6332140238689f302a957627d3cbe18678ea75f3 /cddl/contrib/opensolaris/head/thread.h
parent93ecaabdcb45609ed0c6b0c4a5526eb5fa0de4c0 (diff)
downloadsrc-7149ddc1d302a1d4bf92a5a82d6f46406760c4ec.tar.gz
src-7149ddc1d302a1d4bf92a5a82d6f46406760c4ec.zip
thr_create: new_thread_ID may be NULL
Submitted by: avg MFC after: 3 days
Notes
Notes: svn path=/head/; revision=226615
Diffstat (limited to 'cddl/contrib/opensolaris/head/thread.h')
-rw-r--r--cddl/contrib/opensolaris/head/thread.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/cddl/contrib/opensolaris/head/thread.h b/cddl/contrib/opensolaris/head/thread.h
index 818f0781117a..d813a25dd4bc 100644
--- a/cddl/contrib/opensolaris/head/thread.h
+++ b/cddl/contrib/opensolaris/head/thread.h
@@ -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);