diff options
author | davidxu <davidxu@FreeBSD.org> | 2003-06-10 02:21:32 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2003-06-10 02:21:32 +0000 |
commit | c30bd0e029cde0a777001777351334c0862fd059 (patch) | |
tree | 00914c8b6d0a412a7b9c5c7a92c174e43e363ceb /sys | |
parent | a9b19bb5c665261a190bedea2fe01f5c85d649bb (diff) | |
download | FreeBSD-src-c30bd0e029cde0a777001777351334c0862fd059.zip FreeBSD-src-c30bd0e029cde0a777001777351334c0862fd059.tar.gz |
If there are signals delivered to current thread, breaks out of loop,
userret() will be called again by ast() and thread_userret() will be
called again by userret().
Reported by: tegge
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_kse.c | 7 | ||||
-rw-r--r-- | sys/kern/kern_thread.c | 7 |
2 files changed, 6 insertions, 8 deletions
diff --git a/sys/kern/kern_kse.c b/sys/kern/kern_kse.c index ed37c48..4c2f592 100644 --- a/sys/kern/kern_kse.c +++ b/sys/kern/kern_kse.c @@ -1637,8 +1637,6 @@ thread_userret(struct thread *td, struct trapframe *frame) PROC_LOCK(p); mtx_lock_spin(&sched_lock); while (p->p_numthreads > max_threads_per_proc) { - if (P_SHOULDSTOP(p)) - break; upcalls = 0; FOREACH_KSEGRP_IN_PROC(p, kg2) { if (kg2->kg_numupcalls == 0) @@ -1650,8 +1648,9 @@ thread_userret(struct thread *td, struct trapframe *frame) break; mtx_unlock_spin(&sched_lock); p->p_maxthrwaits++; - msleep(&p->p_numthreads, &p->p_mtx, PPAUSE|PCATCH, - "maxthreads", NULL); + if (msleep(&p->p_numthreads, &p->p_mtx, PPAUSE|PCATCH, + "maxthreads", NULL)) + break; p->p_maxthrwaits--; mtx_lock_spin(&sched_lock); } diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index ed37c48..4c2f592 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -1637,8 +1637,6 @@ thread_userret(struct thread *td, struct trapframe *frame) PROC_LOCK(p); mtx_lock_spin(&sched_lock); while (p->p_numthreads > max_threads_per_proc) { - if (P_SHOULDSTOP(p)) - break; upcalls = 0; FOREACH_KSEGRP_IN_PROC(p, kg2) { if (kg2->kg_numupcalls == 0) @@ -1650,8 +1648,9 @@ thread_userret(struct thread *td, struct trapframe *frame) break; mtx_unlock_spin(&sched_lock); p->p_maxthrwaits++; - msleep(&p->p_numthreads, &p->p_mtx, PPAUSE|PCATCH, - "maxthreads", NULL); + if (msleep(&p->p_numthreads, &p->p_mtx, PPAUSE|PCATCH, + "maxthreads", NULL)) + break; p->p_maxthrwaits--; mtx_lock_spin(&sched_lock); } |