Function parking_lot_core::unpark_one[][src]

pub unsafe fn unpark_one<C>(key: usize, callback: C) -> UnparkResult where
    C: FnOnce(UnparkResult) -> UnparkToken

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.