zephyr::raw

Function k_work_queue_drain

source
pub unsafe extern "C" fn k_work_queue_drain(
    queue: *mut k_work_q,
    plug: bool,
) -> i32
Expand description

@brief Wait until the work queue has drained, optionally plugging it.

This blocks submission to the work queue except when coming from queue thread, and blocks the caller until no more work items are available in the queue.

If @p plug is true then submission will continue to be blocked after the drain operation completes until k_work_queue_unplug() is invoked.

Note that work items that are delayed are not yet associated with their work queue. They must be cancelled externally if a goal is to ensure the work queue remains empty. The @p plug feature can be used to prevent delayed items from being submitted after the drain completes.

@param queue pointer to the queue structure.

@param plug if true the work queue will continue to block new submissions after all items have drained.

@retval 1 if call had to wait for the drain to complete @retval 0 if call did not have to wait @retval negative if wait was interrupted or failed