diff options
author | davidxu <davidxu@FreeBSD.org> | 2002-10-30 02:28:41 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2002-10-30 02:28:41 +0000 |
commit | 7531bd3c2ff53e246074da26bccd32325d78ff40 (patch) | |
tree | 025f0097da64c2bd8954b19f178a9e91c5932b96 /sys/kern/kern_synch.c | |
parent | 869699f61c0699c54295b52a7d4d69ea9d6e0453 (diff) | |
download | FreeBSD-src-7531bd3c2ff53e246074da26bccd32325d78ff40.zip FreeBSD-src-7531bd3c2ff53e246074da26bccd32325d78ff40.tar.gz |
Add an actual implementation of kse_thr_interrupt()
Diffstat (limited to 'sys/kern/kern_synch.c')
-rw-r--r-- | sys/kern/kern_synch.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index abbd7b5..ab5427f 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -157,10 +157,15 @@ msleep(ident, mtx, priority, wmesg, timo) if (p->p_flag & P_KSES) { /* * Just don't bother if we are exiting - * and not the exiting thread. + * and not the exiting thread or thread was marked as + * interrupted. */ - if ((p->p_flag & P_WEXIT) && catch && (p->p_singlethread != td)) + if (catch && + (((p->p_flag & P_WEXIT) && (p->p_singlethread != td)) || + (td->td_flags & TDF_INTERRUPT))) { + td->td_flags &= ~TDF_INTERRUPT; return (EINTR); + } mtx_lock_spin(&sched_lock); if ((td->td_flags & (TDF_UNBOUND|TDF_INMSLEEP)) == TDF_UNBOUND) { @@ -277,6 +282,11 @@ msleep(ident, mtx, priority, wmesg, timo) p->p_stats->p_ru.ru_nivcsw++; mi_switch(); td->td_flags &= ~TDF_TIMOFAIL; + } + if ((td->td_flags & TDF_INTERRUPT) && (priority & PCATCH) && + (rval == 0)) { + td->td_flags &= ~TDF_INTERRUPT; + rval = EINTR; } mtx_unlock_spin(&sched_lock); |