Move call to _malloc_thread_cleanup() so that if this is the last thread,
the call never happens. This is necessary because malloc may be used during exit handler processing. Submitted by: davidxu
This commit is contained in:
parent
3a6fcf1067
commit
5b3842aefa
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=182894
@ -96,9 +96,6 @@ _pthread_exit(void *status)
|
||||
_thread_cleanupspecific();
|
||||
}
|
||||
|
||||
/* Tell malloc that the thread is exiting. */
|
||||
_malloc_thread_cleanup();
|
||||
|
||||
if (!_thr_isthreaded())
|
||||
exit(0);
|
||||
|
||||
@ -109,6 +106,12 @@ _pthread_exit(void *status)
|
||||
exit(0);
|
||||
/* Never reach! */
|
||||
}
|
||||
THREAD_LIST_UNLOCK(curthread);
|
||||
|
||||
/* Tell malloc that the thread is exiting. */
|
||||
_malloc_thread_cleanup();
|
||||
|
||||
THREAD_LIST_LOCK(curthread);
|
||||
THR_LOCK(curthread);
|
||||
curthread->state = PS_DEAD;
|
||||
if (curthread->flags & THR_FLAGS_NEED_SUSPEND) {
|
||||
|
Loading…
Reference in New Issue
Block a user