From 52d9c77df46616472a752a306fbf0e8c02cacf6d Mon Sep 17 00:00:00 2001 From: David Xu Date: Sat, 28 Jun 2003 09:41:59 +0000 Subject: [PATCH] Write new thread pointer back only when success. Reviewed by: deischen --- lib/libkse/thread/thr_create.c | 7 ++++--- lib/libpthread/thread/thr_create.c | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/libkse/thread/thr_create.c b/lib/libkse/thread/thr_create.c index f552ee5ba4d9..e9ab20328eb4 100644 --- a/lib/libkse/thread/thr_create.c +++ b/lib/libkse/thread/thr_create.c @@ -294,9 +294,10 @@ _pthread_create(pthread_t * thread, const pthread_attr_t * attr, ret = _thr_schedule_add(curthread, new_thread); if (ret != 0) free_thread(curthread, new_thread); - - /* Return a pointer to the thread structure: */ - (*thread) = new_thread; + else { + /* Return a pointer to the thread structure: */ + (*thread) = new_thread; + } } } diff --git a/lib/libpthread/thread/thr_create.c b/lib/libpthread/thread/thr_create.c index f552ee5ba4d9..e9ab20328eb4 100644 --- a/lib/libpthread/thread/thr_create.c +++ b/lib/libpthread/thread/thr_create.c @@ -294,9 +294,10 @@ _pthread_create(pthread_t * thread, const pthread_attr_t * attr, ret = _thr_schedule_add(curthread, new_thread); if (ret != 0) free_thread(curthread, new_thread); - - /* Return a pointer to the thread structure: */ - (*thread) = new_thread; + else { + /* Return a pointer to the thread structure: */ + (*thread) = new_thread; + } } }