pub unsafe extern "C" fn k_work_poll_submit_to_queue(
work_q: *mut k_work_q,
work: *mut k_work_poll,
events: *mut k_poll_event,
num_events: i32,
timeout: k_timeout_t,
) -> i32
Expand description
@brief Submit a triggered work item.
This routine schedules work item @a work to be processed by workqueue @a work_q when one of the given @a events is signaled. The routine initiates internal poller for the work item and then returns to the caller. Only when one of the watched events happen the work item is actually submitted to the workqueue and becomes pending.
Submitting a previously submitted triggered work item that is still waiting for the event cancels the existing submission and reschedules it the using the new event list. Note that this behavior is inherently subject to race conditions with the pre-existing triggered work item and work queue, so care must be taken to synchronize such resubmissions externally.
@funcprops \isr_ok
@warning Provided array of events as well as a triggered work item must be placed in persistent memory (valid until work handler execution or work cancellation) and cannot be modified after submission.
@param work_q Address of workqueue. @param work Address of delayed work item. @param events An array of events which trigger the work. @param num_events The number of events in the array. @param timeout Timeout after which the work will be scheduled for execution even if not triggered.
@retval 0 Work item started watching for events. @retval -EINVAL Work item is being processed or has completed its work. @retval -EADDRINUSE Work item is pending on a different workqueue.