diff options
author | deischen <deischen@FreeBSD.org> | 2003-08-30 12:09:16 +0000 |
---|---|---|
committer | deischen <deischen@FreeBSD.org> | 2003-08-30 12:09:16 +0000 |
commit | e8c434f7c55809a53a64211ba5234f1f59e72df8 (patch) | |
tree | 649c131bbf3c8d43b384605ae63362520cbcf914 /lib/libpthread/thread/thr_kern.c | |
parent | 8556106f5aa1aee86b61963f6d818b6b8322bfa9 (diff) | |
download | FreeBSD-src-e8c434f7c55809a53a64211ba5234f1f59e72df8.zip FreeBSD-src-e8c434f7c55809a53a64211ba5234f1f59e72df8.tar.gz |
Allow the concurrency level to be reduced.
Reviewed by: davidxu
Diffstat (limited to 'lib/libpthread/thread/thr_kern.c')
-rw-r--r-- | lib/libpthread/thread/thr_kern.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/libpthread/thread/thr_kern.c b/lib/libpthread/thread/thr_kern.c index 33b4c54..d7e28ba 100644 --- a/lib/libpthread/thread/thr_kern.c +++ b/lib/libpthread/thread/thr_kern.c @@ -1047,7 +1047,8 @@ kse_sched_multi(struct kse_mailbox *kmbx) /* Check if there are no threads ready to run: */ while (((curthread = KSE_RUNQ_FIRST(curkse)) == NULL) && - (curkse->k_kseg->kg_threadcount != 0)) { + (curkse->k_kseg->kg_threadcount != 0) && + ((curkse->k_flags & KF_TERMINATED) == 0)) { /* * Wait for a thread to become active or until there are * no more threads. @@ -1059,7 +1060,8 @@ kse_sched_multi(struct kse_mailbox *kmbx) } /* Check for no more threads: */ - if (curkse->k_kseg->kg_threadcount == 0) { + if ((curkse->k_kseg->kg_threadcount == 0) || + ((curkse->k_flags & KF_TERMINATED) != 0)) { /* * Normally this shouldn't return, but it will if there * are other KSEs running that create new threads that @@ -1874,12 +1876,12 @@ kse_fini(struct kse *kse) PANIC("kse_exit()"); #endif } else { -#ifdef NOT_YET /* - * In future, we might allow program to kill - * kse in initial group. + * We allow program to kill kse in initial group (by + * lowering the concurrency). */ - if (kse != _kse_initial) { + if ((kse != _kse_initial) && + ((kse->k_flags & KF_TERMINATED) != 0)) { KSE_SCHED_LOCK(kse, kse->k_kseg); TAILQ_REMOVE(&kse->k_kseg->kg_kseq, kse, k_kgqe); kse->k_kseg->kg_ksecount--; @@ -1891,7 +1893,6 @@ kse_fini(struct kse *kse) /* Never returns. */ PANIC("kse_exit() failed for initial kseg"); } -#endif KSE_SCHED_LOCK(kse, kse->k_kseg); KSE_SET_IDLE(kse); kse->k_kseg->kg_idle_kses++; |