summaryrefslogtreecommitdiffstats
path: root/lib/libthr/thread/thr_create.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libthr/thread/thr_create.c')
-rw-r--r--lib/libthr/thread/thr_create.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/libthr/thread/thr_create.c b/lib/libthr/thread/thr_create.c
index 334dc12..3033421 100644
--- a/lib/libthr/thread/thr_create.c
+++ b/lib/libthr/thread/thr_create.c
@@ -155,16 +155,14 @@ _pthread_create(pthread_t * thread, const pthread_attr_t * attr,
new_thread->flags = 0;
/*
- * Protect the scheduling queues.
- */
- GIANT_LOCK(curthread);
-
- /*
* Initialise the unique id which GDB uses to
* track threads.
*/
new_thread->uniqueid = next_uniqueid++;
+ THREAD_LIST_LOCK;
+ _thread_critical_enter(new_thread);
+
/*
* Check if the garbage collector thread
* needs to be started.
@@ -174,6 +172,8 @@ _pthread_create(pthread_t * thread, const pthread_attr_t * attr,
/* Add the thread to the linked list of all threads: */
TAILQ_INSERT_HEAD(&_thread_list, new_thread, tle);
+ THREAD_LIST_UNLOCK;
+
/*
* Create the thread.
*
@@ -190,11 +190,11 @@ _pthread_create(pthread_t * thread, const pthread_attr_t * attr,
PANIC("thr_create");
}
- GIANT_UNLOCK(curthread);
-
/* Return a pointer to the thread structure: */
(*thread) = new_thread;
+ _thread_critical_exit(new_thread);
+
/*
* Start a garbage collector thread
* if necessary.
OpenPOWER on IntegriCloud