summaryrefslogtreecommitdiffstats
path: root/lib/libthr/thread/thr_create.c
diff options
context:
space:
mode:
authorsjg <sjg@FreeBSD.org>2015-05-27 01:19:58 +0000
committersjg <sjg@FreeBSD.org>2015-05-27 01:19:58 +0000
commit65145fa4c81da358fcbc3b650156dab705dfa34e (patch)
tree55c065b6730aaac2afb6c29933ee6ec5fa4c4249 /lib/libthr/thread/thr_create.c
parent60ff4eb0dff94a04d75d0d52a3957aaaf5f8c693 (diff)
parente6b664c390af88d4a87208bc042ce503da664c3b (diff)
downloadFreeBSD-src-65145fa4c81da358fcbc3b650156dab705dfa34e.zip
FreeBSD-src-65145fa4c81da358fcbc3b650156dab705dfa34e.tar.gz
Merge sync of head
Diffstat (limited to 'lib/libthr/thread/thr_create.c')
-rw-r--r--lib/libthr/thread/thr_create.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/libthr/thread/thr_create.c b/lib/libthr/thread/thr_create.c
index a41b33f..df3509d 100644
--- a/lib/libthr/thread/thr_create.c
+++ b/lib/libthr/thread/thr_create.c
@@ -40,6 +40,7 @@
#include <pthread_np.h>
#include "un-namespace.h"
+#include "libc_private.h"
#include "thr_private.h"
static int create_stack(struct pthread_attr *pattr);
@@ -66,8 +67,11 @@ _pthread_create(pthread_t * thread, const pthread_attr_t * attr,
/*
* Tell libc and others now they need lock to protect their data.
*/
- if (_thr_isthreaded() == 0 && _thr_setthreaded(1))
- return (EAGAIN);
+ if (_thr_isthreaded() == 0) {
+ _malloc_first_thread();
+ if (_thr_setthreaded(1))
+ return (EAGAIN);
+ }
curthread = _get_curthread();
if ((new_thread = _thr_alloc(curthread)) == NULL)
OpenPOWER on IntegriCloud