diff options
author | Julian Elischer <julian@FreeBSD.org> | 2002-09-11 08:13:56 +0000 |
---|---|---|
committer | Julian Elischer <julian@FreeBSD.org> | 2002-09-11 08:13:56 +0000 |
commit | 71fad9fdeefd5d874768802125f98ea6450cfa5c (patch) | |
tree | 10514ece7d621a24c034e4c778c793b9ea2d9675 /sys/kern/kern_switch.c | |
parent | 527eee2d404ad5415be0b17e0403d29f3ea924c3 (diff) | |
download | src-71fad9fdeefd5d874768802125f98ea6450cfa5c.tar.gz src-71fad9fdeefd5d874768802125f98ea6450cfa5c.zip |
Completely redo thread states.
Reviewed by: davidxu@freebsd.org
Notes
Notes:
svn path=/head/; revision=103216
Diffstat (limited to 'sys/kern/kern_switch.c')
-rw-r--r-- | sys/kern/kern_switch.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/kern/kern_switch.c b/sys/kern/kern_switch.c index f7041214819d..6ccc9169c261 100644 --- a/sys/kern/kern_switch.c +++ b/sys/kern/kern_switch.c @@ -163,7 +163,7 @@ retry: if (panicstr && ((td->td_proc->p_flag & P_SYSTEM) == 0 && (td->td_flags & TDF_INPANIC) == 0)) goto retry; - td->td_state = TDS_RUNNING; + TD_SET_RUNNING(td); return (td); } @@ -229,8 +229,7 @@ remrunqueue(struct thread *td) struct kse *ke; mtx_assert(&sched_lock, MA_OWNED); - KASSERT ((td->td_state == TDS_RUNQ), - ("remrunqueue: Bad state on run queue")); + KASSERT ((TD_ON_RUNQ(td)), ("remrunqueue: Bad state on run queue")); kg = td->td_ksegrp; ke = td->td_kse; /* @@ -238,8 +237,8 @@ remrunqueue(struct thread *td) * threads are BOUND. */ CTR1(KTR_RUNQ, "remrunqueue: td%p", td); - td->td_state = TDS_UNQUEUED; kg->kg_runnable--; + TD_SET_CAN_RUN(td); if ((td->td_flags & TDF_UNBOUND) == 0) { /* Bring its kse with it, leave the thread attached */ runq_remove(&runq, ke); @@ -300,8 +299,9 @@ setrunqueue(struct thread *td) CTR1(KTR_RUNQ, "setrunqueue: td%p", td); mtx_assert(&sched_lock, MA_OWNED); - KASSERT((td->td_state != TDS_RUNQ), ("setrunqueue: bad thread state")); - td->td_state = TDS_RUNQ; + KASSERT((TD_CAN_RUN(td) || TD_IS_RUNNING(td)), + ("setrunqueue: bad thread state")); + TD_SET_RUNQ(td); kg = td->td_ksegrp; kg->kg_runnable++; if ((td->td_flags & TDF_UNBOUND) == 0) { @@ -715,7 +715,7 @@ thread_sanity_check(struct thread *td) } FOREACH_THREAD_IN_GROUP(kg, td2) { if (((td2->td_flags & TDF_UNBOUND) == 0) && - (td2->td_state == TDS_RUNQ)) { + (TD_ON_RUNQ(td2))) { assigned++; if (td2->td_kse == NULL) { panic ("BOUND thread with no KSE"); |