summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2003-08-16 05:22:20 +0000
committerdavidxu <davidxu@FreeBSD.org>2003-08-16 05:22:20 +0000
commite6953270863cc4d7c27b7dc4ebbacb6f099fd9ed (patch)
tree5f51a64ab072dffc20cf01dc4b6cedb67338b67a /lib
parent206928815a48228f66978426e413fcc5fcfaa82d (diff)
downloadFreeBSD-src-e6953270863cc4d7c27b7dc4ebbacb6f099fd9ed.zip
FreeBSD-src-e6953270863cc4d7c27b7dc4ebbacb6f099fd9ed.tar.gz
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
Diffstat (limited to 'lib')
-rw-r--r--lib/libkse/thread/thr_kern.c20
-rw-r--r--lib/libpthread/thread/thr_kern.c20
2 files changed, 22 insertions, 18 deletions
diff --git a/lib/libkse/thread/thr_kern.c b/lib/libkse/thread/thr_kern.c
index c78a28a..ae151d7 100644
--- a/lib/libkse/thread/thr_kern.c
+++ b/lib/libkse/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);
}
}
diff --git a/lib/libpthread/thread/thr_kern.c b/lib/libpthread/thread/thr_kern.c
index c78a28a..ae151d7 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);
}
}
OpenPOWER on IntegriCloud