Function esp_idf_sys::esp_event_loop_run
source ยท pub unsafe extern "C" fn esp_event_loop_run(
event_loop: esp_event_loop_handle_t,
ticks_to_run: TickType_t,
) -> esp_err_t
Expand description
@brief Dispatch events posted to an event loop.
This function is used to dispatch events posted to a loop with no dedicated task, i.e. task name was set to NULL in event_loop_args argument during loop creation. This function includes an argument to limit the amount of time it runs, returning control to the caller when that time expires (or some time afterwards). There is no guarantee that a call to this function will exit at exactly the time of expiry. There is also no guarantee that events have been dispatched during the call, as the function might have spent all the allotted time waiting on the event queue. Once an event has been dequeued, however, it is guaranteed to be dispatched. This guarantee contributes to not being able to exit exactly at time of expiry as (1) blocking on internal mutexes is necessary for dispatching the dequeued event, and (2) during dispatch of the dequeued event there is no way to control the time occupied by handler code execution. The guaranteed time of exit is therefore the allotted time + amount of time required to dispatch the last dequeued event.
In cases where waiting on the queue times out, ESP_OK is returned and not ESP_ERR_TIMEOUT, since it is normal behavior.
@param[in] event_loop event loop to dispatch posted events from, must not be NULL @param[in] ticks_to_run number of ticks to run the loop
@note encountering an unknown event that has been posted to the loop will only generate a warning, not an error.
@return
- ESP_OK: Success
- Others: Fail