Function parking_lot::unpark_requeue
[−]
[src]
pub unsafe fn unpark_requeue(key_from: usize, key_to: usize, validate: &mut FnMut() -> RequeueOp, callback: &mut FnMut(RequeueOp, usize)) -> usize
Removes all threads from the queue associated with key_from
, optionally
unparks the first one and requeues the rest onto the queue associated with
key_to
.
The validate
function is called while both queues are locked and can abort
the operation by returning RequeueOp::Abort
. It can also choose to
unpark the first thread in the source queue while moving the rest by
returning RequeueOp::UnparkFirstRequeueRest
. Returning
RequeueOp::RequeueAll
will move all threads to the destination queue.
The callback
function is also called while both queues are locked. It is
passed the RequeueOp
returned by validate
and the number of threads that
were removed from the original queue.
This function returns the number of threads that were removed from the original queue.
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 validate
and callback
functions are called while the queue is locked
and must not panic or call into any function in parking_lot
.