Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_thread.c
Show First 20 Lines • Show All 1,508 Lines • ▼ Show 20 Lines | if (td->td_proc == p) { | ||||
if (boundary && (td->td_flags & TDF_BOUNDARY) != 0) { | if (boundary && (td->td_flags & TDF_BOUNDARY) != 0) { | ||||
td->td_flags &= ~TDF_BOUNDARY; | td->td_flags &= ~TDF_BOUNDARY; | ||||
p->p_boundary_count--; | p->p_boundary_count--; | ||||
} | } | ||||
} | } | ||||
return (setrunnable(td, 0)); | return (setrunnable(td, 0)); | ||||
} | } | ||||
int | |||||
thread_run_flash(struct thread *td) | |||||
markj: I've seen "flash" used in a few times in synchronization primitives, though I can't find any… | |||||
Done Inline ActionsI mean that run is scope-bound, the thread is run for limited block of code, and then put back to suspension. It is not intended to be fully runnable state, e.g. an attempt to return to userspace would cause invariants check. Like flashlight flash. kib: I mean that run is scope-bound, the thread is run for limited block of code, and then put back… | |||||
{ | |||||
struct proc *p; | |||||
p = td->td_proc; | |||||
PROC_LOCK_ASSERT(p, MA_OWNED); | |||||
if (TD_ON_SLEEPQ(td)) | |||||
sleepq_remove_nested(td); | |||||
else | |||||
thread_lock(td); | |||||
THREAD_LOCK_ASSERT(td, MA_OWNED); | |||||
KASSERT(TD_IS_SUSPENDED(td), ("Thread not suspended")); | |||||
TD_CLR_SUSPENDED(td); | |||||
PROC_SLOCK(p); | |||||
MPASS(p->p_suspcount > 0); | |||||
Done Inline ActionsAssert > 0? markj: Assert > 0? | |||||
Done Inline ActionsTD_IS_SUSPENDED should be enough, but ok. kib: TD_IS_SUSPENDED should be enough, but ok. | |||||
p->p_suspcount--; | |||||
PROC_SUNLOCK(p); | |||||
return (setrunnable(td, 0)); | |||||
markjUnsubmitted Done Inline ActionsWhy is the caller responsible for kicking the swapper? It seems reasonable to handle it here. I also don't see why the caller drops the proc lock to call kick_proc0(). markj: Why is the caller responsible for kicking the swapper? It seems reasonable to handle it here. I… | |||||
} | |||||
/* | /* | ||||
* Allow all threads blocked by single threading to continue running. | * Allow all threads blocked by single threading to continue running. | ||||
*/ | */ | ||||
void | void | ||||
thread_unsuspend(struct proc *p) | thread_unsuspend(struct proc *p) | ||||
{ | { | ||||
struct thread *td; | struct thread *td; | ||||
int wakeup_swapper; | int wakeup_swapper; | ||||
▲ Show 20 Lines • Show All 184 Lines • Show Last 20 Lines |
I've seen "flash" used in a few times in synchronization primitives, though I can't find any examples now. What does it mean?