* Sets a timeout that will remove the current thread from the specified * sleep queue after timo ticks if the thread has not already been awakened. */
| 392 | * sleep queue after timo ticks if the thread has not already been awakened. |
| 393 | */ |
| 394 | void |
| 395 | sleepq_set_timeout_sbt(const void *wchan, sbintime_t sbt, sbintime_t pr, |
| 396 | int flags) |
| 397 | { |
| 398 | struct sleepqueue_chain *sc __unused; |
| 399 | struct thread *td; |
| 400 | sbintime_t pr1; |
| 401 | |
| 402 | td = curthread; |
| 403 | sc = SC_LOOKUP(wchan); |
| 404 | mtx_assert(&sc->sc_lock, MA_OWNED); |
| 405 | MPASS(TD_ON_SLEEPQ(td)); |
| 406 | MPASS(td->td_sleepqueue == NULL); |
| 407 | MPASS(wchan != NULL); |
| 408 | if (cold && td == &thread0) |
| 409 | panic("timed sleep before timers are working"); |
| 410 | KASSERT(td->td_sleeptimo == 0, ("td %d %p td_sleeptimo %jx", |
| 411 | td->td_tid, td, (uintmax_t)td->td_sleeptimo)); |
| 412 | thread_lock(td); |
| 413 | callout_when(sbt, pr, flags, &td->td_sleeptimo, &pr1); |
| 414 | thread_unlock(td); |
| 415 | callout_reset_sbt_on(&td->td_slpcallout, td->td_sleeptimo, pr1, |
| 416 | sleepq_timeout, td, PCPU_GET(cpuid), flags | C_PRECALC | |
| 417 | C_DIRECT_EXEC); |
| 418 | } |
| 419 | |
| 420 | /* |
| 421 | * Return the number of actual sleepers for the specified queue. |
no test coverage detected