Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Oct 2011 13:54:58 +0000 (UTC)
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r226615 - head/cddl/contrib/opensolaris/head
Message-ID:  <201110211354.p9LDswbZ027113@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pjd
Date: Fri Oct 21 13:54:58 2011
New Revision: 226615
URL: http://svn.freebsd.org/changeset/base/226615

Log:
  thr_create: new_thread_ID may be NULL
  
  Submitted by:	avg
  MFC after:	3 days

Modified:
  head/cddl/contrib/opensolaris/head/thread.h

Modified: head/cddl/contrib/opensolaris/head/thread.h
==============================================================================
--- head/cddl/contrib/opensolaris/head/thread.h	Fri Oct 21 13:54:17 2011	(r226614)
+++ head/cddl/contrib/opensolaris/head/thread.h	Fri Oct 21 13:54:58 2011	(r226615)
@@ -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 stac
 	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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201110211354.p9LDswbZ027113>