aboutsummaryrefslogtreecommitdiff
path: root/lib/libpthread/thread
diff options
context:
space:
mode:
authorDavid Xu <davidxu@FreeBSD.org>2003-08-16 05:22:20 +0000
committerDavid Xu <davidxu@FreeBSD.org>2003-08-16 05:22:20 +0000
commit56b39ee1c2097e81279c32b2d5d53045a13cf025 (patch)
tree5f51a64ab072dffc20cf01dc4b6cedb67338b67a /lib/libpthread/thread
parent61cc495a297c639149178e15b218175ddd285cf2 (diff)
downloadsrc-56b39ee1c2097e81279c32b2d5d53045a13cf025.tar.gz
src-56b39ee1c2097e81279c32b2d5d53045a13cf025.zip
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
Notes
Notes: svn path=/head/; revision=118985
Diffstat (limited to 'lib/libpthread/thread')
-rw-r--r--lib/libpthread/thread/thr_kern.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/libpthread/thread/thr_kern.c b/lib/libpthread/thread/thr_kern.c
index c78a28ac7a94..ae151d7b9a84 100644
--- a/lib/libpthread/thread/thr_kern.c
+++ b/lib/libpthread/thread/thr_kern.c
@@ -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);
}
}