Write new thread pointer back only when success.

Reviewed by: deischen
This commit is contained in:
David Xu 2003-06-28 09:41:59 +00:00
parent a56b526b51
commit 52d9c77df4
2 changed files with 8 additions and 6 deletions

View File

@ -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;
}
}
}

View File

@ -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;
}
}
}