mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-11 09:50:12 +00:00
Keep initial kse and kse group just like we keep initial thread,
Don't free them, so some code can still reference them. Reviewed by: deischen
This commit is contained in:
parent
61cc495a29
commit
56b39ee1c2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=118985
@ -1336,6 +1336,15 @@ thread_gc(struct pthread *curthread)
|
||||
|
||||
while ((td = TAILQ_FIRST(&worklist)) != NULL) {
|
||||
TAILQ_REMOVE(&worklist, td, gcle);
|
||||
/*
|
||||
* XXX we don't free initial thread and its kse
|
||||
* (if thread is a bound thread), because there might
|
||||
* have some code referencing initial thread and kse.
|
||||
*/
|
||||
if (td == _thr_initial) {
|
||||
DBG_MSG("Initial thread won't be freed\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((td->attr.flags & PTHREAD_SCOPE_SYSTEM) != 0) {
|
||||
crit = _kse_critical_enter();
|
||||
@ -1345,15 +1354,8 @@ thread_gc(struct pthread *curthread)
|
||||
KSE_LOCK_RELEASE(curthread->kse, &kse_lock);
|
||||
_kse_critical_leave(crit);
|
||||
}
|
||||
/*
|
||||
* XXX we don't free initial thread, because there might
|
||||
* have some code referencing initial thread.
|
||||
*/
|
||||
if (td != _thr_initial) {
|
||||
DBG_MSG("Freeing thread %p\n", td);
|
||||
_thr_free(curthread, td);
|
||||
} else
|
||||
DBG_MSG("Initial thread won't be freed\n");
|
||||
DBG_MSG("Freeing thread %p\n", td);
|
||||
_thr_free(curthread, td);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1336,6 +1336,15 @@ thread_gc(struct pthread *curthread)
|
||||
|
||||
while ((td = TAILQ_FIRST(&worklist)) != NULL) {
|
||||
TAILQ_REMOVE(&worklist, td, gcle);
|
||||
/*
|
||||
* XXX we don't free initial thread and its kse
|
||||
* (if thread is a bound thread), because there might
|
||||
* have some code referencing initial thread and kse.
|
||||
*/
|
||||
if (td == _thr_initial) {
|
||||
DBG_MSG("Initial thread won't be freed\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((td->attr.flags & PTHREAD_SCOPE_SYSTEM) != 0) {
|
||||
crit = _kse_critical_enter();
|
||||
@ -1345,15 +1354,8 @@ thread_gc(struct pthread *curthread)
|
||||
KSE_LOCK_RELEASE(curthread->kse, &kse_lock);
|
||||
_kse_critical_leave(crit);
|
||||
}
|
||||
/*
|
||||
* XXX we don't free initial thread, because there might
|
||||
* have some code referencing initial thread.
|
||||
*/
|
||||
if (td != _thr_initial) {
|
||||
DBG_MSG("Freeing thread %p\n", td);
|
||||
_thr_free(curthread, td);
|
||||
} else
|
||||
DBG_MSG("Initial thread won't be freed\n");
|
||||
DBG_MSG("Freeing thread %p\n", td);
|
||||
_thr_free(curthread, td);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user