pub unsafe fn park<V, B, T>(
) -> ParkResult where
V: FnOnce() -> bool,
T: FnOnce(usize, bool),
Parks the current thread in the queue associated with the given key.
validate function is called while the queue is locked and can abort
the operation by returning false. If
validate returns true then the
current thread is appended to the queue and the queue is unlocked.
before_sleep function is called after the queue is unlocked but before
the thread is put to sleep. The thread will then sleep until it is unparked
or the given timeout is reached.
timed_out function is also called while the queue is locked, but only
if the timeout was reached. It is passed the key of the queue it was in when
it timed out, which may be different from the original key if
unpark_requeue was called. It is also passed a bool which indicates
whether it was the last thread in the queue.
You should only call this function with an address that you control, since you could otherwise interfere with the operation of other synchronization primitives.
timed_out functions are called while the queue is
locked and must not panic or call into any function in
before_sleep function is called outside the queue lock and is allowed
it is not allowed to call
park or panic.