summaryrefslogtreecommitdiffstats
path: root/lib/libpthread/thread/thr_create.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libpthread/thread/thr_create.c')
-rw-r--r--lib/libpthread/thread/thr_create.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/libpthread/thread/thr_create.c b/lib/libpthread/thread/thr_create.c
index deb26de..4c65d3c 100644
--- a/lib/libpthread/thread/thr_create.c
+++ b/lib/libpthread/thread/thr_create.c
@@ -297,6 +297,13 @@ _pthread_create(pthread_t * thread, const pthread_attr_t * attr,
* pair if necessary.
*/
ret = _thr_schedule_add(curthread, new_thread);
+ if (ret != 0) {
+ KSE_LOCK_ACQUIRE(curthread->kse,
+ &_thread_list_lock);
+ THR_LIST_REMOVE(new_thread);
+ KSE_LOCK_RELEASE(curthread->kse,
+ &_thread_list_lock);
+ }
_kse_critical_leave(crit);
if (ret != 0)
free_thread(curthread, new_thread);
OpenPOWER on IntegriCloud