Changeset View
Changeset View
Standalone View
Standalone View
head/sys/kern/kern_timeout.c
Show First 20 Lines • Show All 1,139 Lines • ▼ Show 20 Lines | if (cc_exec_curr(cc, direct) == c) { | ||||
if ((flags & CS_DRAIN) != 0) { | if ((flags & CS_DRAIN) != 0) { | ||||
/* | /* | ||||
* The current callout is running (or just | * The current callout is running (or just | ||||
* about to run) and blocking is allowed, so | * about to run) and blocking is allowed, so | ||||
* just wait for the current invocation to | * just wait for the current invocation to | ||||
* finish. | * finish. | ||||
*/ | */ | ||||
while (cc_exec_curr(cc, direct) == c) { | if (cc_exec_curr(cc, direct) == c) { | ||||
/* | /* | ||||
* Use direct calls to sleepqueue interface | * Use direct calls to sleepqueue interface | ||||
* instead of cv/msleep in order to avoid | * instead of cv/msleep in order to avoid | ||||
* a LOR between cc_lock and sleepqueue | * a LOR between cc_lock and sleepqueue | ||||
* chain spinlocks. This piece of code | * chain spinlocks. This piece of code | ||||
* emulates a msleep_spin() call actually. | * emulates a msleep_spin() call actually. | ||||
* | * | ||||
* If we already have the sleepqueue chain | * If we already have the sleepqueue chain | ||||
Show All 31 Lines | if ((flags & CS_DRAIN) != 0) { | ||||
sleepq_wait( | sleepq_wait( | ||||
&cc_exec_waiting(cc, direct), | &cc_exec_waiting(cc, direct), | ||||
0); | 0); | ||||
sq_locked = 0; | sq_locked = 0; | ||||
old_cc = NULL; | old_cc = NULL; | ||||
/* Reacquire locks previously released. */ | /* Reacquire locks previously released. */ | ||||
PICKUP_GIANT(); | PICKUP_GIANT(); | ||||
CC_LOCK(cc); | goto again; | ||||
} | } | ||||
c->c_flags &= ~CALLOUT_ACTIVE; | c->c_flags &= ~CALLOUT_ACTIVE; | ||||
} else if (use_lock && | } else if (use_lock && | ||||
!cc_exec_cancel(cc, direct) && (drain == NULL)) { | !cc_exec_cancel(cc, direct) && (drain == NULL)) { | ||||
/* | /* | ||||
* The current callout is waiting for its | * The current callout is waiting for its | ||||
* lock which we hold. Cancel the callout | * lock which we hold. Cancel the callout | ||||
▲ Show 20 Lines • Show All 380 Lines • Show Last 20 Lines |