pub unsafe fn unpark_one(
    key: usize,
    callback: impl FnOnce(UnparkResult) -> UnparkToken
) -> UnparkResult
Expand description

Unparks one thread from the queue associated with the given key.

The callback function is called while the queue is locked and before the target thread is woken up. The UnparkResult argument to the function indicates whether a thread was found in the queue and whether this was the last thread in the queue. This value is also returned by unpark_one.

The callback function should return an UnparkToken value which will be passed to the thread that is unparked. If no thread is unparked then the returned value is ignored.

Safety

You should only call this function with an address that you control, since you could otherwise interfere with the operation of other synchronization primitives.

The callback function is called while the queue is locked and must not panic or call into any function in parking_lot.

The parking_lot functions are not re-entrant and calling this method from the context of an asynchronous signal handler may result in undefined behavior, including corruption of internal state and/or deadlocks.