Allow hooks registered by atexit() to run with current thread pointer set,

without this change, my atexit test dumps core.
This commit is contained in:
David Xu 2003-09-04 05:24:53 +00:00
parent eb7f25e17e
commit 0318c367fc
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=119732
2 changed files with 8 additions and 2 deletions

View File

@ -1246,7 +1246,6 @@ thr_cleanup(struct kse *curkse, struct pthread *thread)
KSE_SCHED_UNLOCK(curkse, curkse->k_kseg);
DBG_MSG("Adding thread %p to GC list\n", thread);
KSE_LOCK_ACQUIRE(curkse, &_thread_list_lock);
THR_GCLIST_ADD(thread);
/* Use thread_list_lock */
active_threads--;
#ifdef SYSTEM_SCOPE_ONLY
@ -1255,8 +1254,12 @@ thr_cleanup(struct kse *curkse, struct pthread *thread)
if (active_threads == 1) {
#endif
KSE_LOCK_RELEASE(curkse, &_thread_list_lock);
/* Possible use a signalcontext wrapper to call exit ? */
curkse->k_curthread = thread;
_tcb_set(curkse->k_kcb, thread->tcb);
exit(0);
}
THR_GCLIST_ADD(thread);
KSE_LOCK_RELEASE(curkse, &_thread_list_lock);
if (sys_scope) {
/*

View File

@ -1246,7 +1246,6 @@ thr_cleanup(struct kse *curkse, struct pthread *thread)
KSE_SCHED_UNLOCK(curkse, curkse->k_kseg);
DBG_MSG("Adding thread %p to GC list\n", thread);
KSE_LOCK_ACQUIRE(curkse, &_thread_list_lock);
THR_GCLIST_ADD(thread);
/* Use thread_list_lock */
active_threads--;
#ifdef SYSTEM_SCOPE_ONLY
@ -1255,8 +1254,12 @@ thr_cleanup(struct kse *curkse, struct pthread *thread)
if (active_threads == 1) {
#endif
KSE_LOCK_RELEASE(curkse, &_thread_list_lock);
/* Possible use a signalcontext wrapper to call exit ? */
curkse->k_curthread = thread;
_tcb_set(curkse->k_kcb, thread->tcb);
exit(0);
}
THR_GCLIST_ADD(thread);
KSE_LOCK_RELEASE(curkse, &_thread_list_lock);
if (sys_scope) {
/*