summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_synch.c
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>2002-10-25 07:11:12 +0000
committerjulian <julian@FreeBSD.org>2002-10-25 07:11:12 +0000
commit4ea837f673e35a1bd44b7a3a83d08c96d42e1b81 (patch)
tree45eb9c5b87d56720d1194f404349dd8746e61573 /sys/kern/kern_synch.c
parent59e43a0396de61b22eadda85d6d3d4586710c0b9 (diff)
downloadFreeBSD-src-4ea837f673e35a1bd44b7a3a83d08c96d42e1b81.zip
FreeBSD-src-4ea837f673e35a1bd44b7a3a83d08c96d42e1b81.tar.gz
More work on the interaction between suspending and sleeping threads.
Also clean up some code used with 'single-threading'. Reviewed by: davidxu
Diffstat (limited to 'sys/kern/kern_synch.c')
-rw-r--r--sys/kern/kern_synch.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index b758c96..abbd7b5 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -155,26 +155,29 @@ msleep(ident, mtx, priority, wmesg, timo)
* Hence the TDF_INMSLEEP flag.
*/
if (p->p_flag & P_KSES) {
- /* Just don't bother if we are exiting
- and not the exiting thread. */
- if ((p->p_flag & P_WEXIT) && catch && p->p_singlethread != td)
+ /*
+ * Just don't bother if we are exiting
+ * and not the exiting thread.
+ */
+ if ((p->p_flag & P_WEXIT) && catch && (p->p_singlethread != td))
return (EINTR);
- if (td->td_mailbox && (!(td->td_flags & TDF_INMSLEEP))) {
+ mtx_lock_spin(&sched_lock);
+ if ((td->td_flags & (TDF_UNBOUND|TDF_INMSLEEP)) ==
+ TDF_UNBOUND) {
/*
* Arrange for an upcall to be readied.
* it will not actually happen until all
* pending in-kernel work for this KSEGRP
* has been done.
*/
- mtx_lock_spin(&sched_lock);
/* Don't recurse here! */
td->td_flags |= TDF_INMSLEEP;
thread_schedule_upcall(td, td->td_kse);
td->td_flags &= ~TDF_INMSLEEP;
- mtx_unlock_spin(&sched_lock);
}
+ } else {
+ mtx_lock_spin(&sched_lock);
}
- mtx_lock_spin(&sched_lock);
if (cold ) {
/*
* During autoconfiguration, just give interrupts
OpenPOWER on IntegriCloud