µEvLoop
A fast and lightweight event loop aimed at embedded platforms in C99.
|
Defines events and methods to configure events. More...
Go to the source code of this file.
Data Structures | |
struct | uel_event_t |
Events are special messages passed around the core. They represent tasks to be run at some point by the system. More... | |
union | uel_event_t::uel_event_detail |
struct | uel_event_t::uel_event_detail::uel_event_timer |
Contains information suitable for scheduling an event at the scheduler. More... | |
struct | uel_event_t::uel_event_detail::uel_event_signal |
Contains information related to an emitted signal . More... | |
struct | uel_event_t::uel_event_detail::uel_event_listener |
Contains the context of a particular signal listener. More... | |
struct | uel_event_t::uel_event_detail::uel_event_observer |
Contains the reference to an observer variable. More... | |
Typedefs | |
typedef enum uel_event_type | uel_event_type_t |
Alias to the uel_event_type enum. | |
typedef enum uel_event_timer_status | uel_event_timer_status_t |
Alias to the uel_event_timer_status. | |
Enumerations | |
enum | uel_event_type { UEL_CLOSURE_EVENT, UEL_TIMER_EVENT, UEL_SIGNAL_EVENT, UEL_SIGNAL_LISTENER_EVENT, UEL_OBSERVER_EVENT } |
Possible types of events understood by the core. | |
enum | uel_event_timer_status { UEL_TIMER_RUNNING, UEL_TIMER_PAUSED, UEL_TIMER_CANCELLED } |
Possible statuses for a timer event. | |
Functions | |
void | uel_event_config_closure (uel_event_t *event, uel_closure_t *closure, void *value, bool repeating) |
Configures a closure event. More... | |
void | uel_event_config_signal (uel_event_t *event, uintptr_t signal, uel_llist_t *listeners, void *params) |
Configures a signal event. More... | |
void | uel_event_config_signal_listener (uel_event_t *event, uel_closure_t *closure, bool repeating) |
Configures a signal listener event. More... | |
void | uel_event_config_observer (uel_event_t *event, uel_closure_t *closure, volatile uintptr_t *condition_var, bool repeating) |
Configures an observer event. More... | |
void | uel_event_observer_cancel (uel_event_t *event) |
Cancels an observer. More... | |
void | uel_event_config_timer (uel_event_t *event, uint16_t timeout_in_ms, bool repeating, bool immediate, uel_closure_t *closure, void *value, uint32_t current_time) |
Configures a timer event. More... | |
void | uel_event_timer_pause (uel_event_t *event) |
Pauses a timer event. More... | |
void | uel_event_timer_resume (uel_event_t *event) |
Resumes a paused timer event. More... | |
void | uel_event_timer_cancel (uel_event_t *event) |
Cancels a timer event. More... | |
Defines events and methods to configure events.
void uel_event_config_closure | ( | uel_event_t * | event, |
uel_closure_t * | closure, | ||
void * | value, | ||
bool | repeating | ||
) |
Configures a closure event.
event | The event to be configured |
closure | The closure to be invoked when the event is run |
value | The value to supply to the closure as parameters when it is invoked |
repeating | Intructs the system whether should this event be disposed of after processing |
void uel_event_config_observer | ( | uel_event_t * | event, |
uel_closure_t * | closure, | ||
volatile uintptr_t * | condition_var, | ||
bool | repeating | ||
) |
Configures an observer event.
event | The event to be configured |
closure | The closure to be invoked when the observed value changes |
condition_var | The address of a volatile variable to be observed |
repeating | Intructs the system whether should this event be disposed of after processing |
void uel_event_config_signal | ( | uel_event_t * | event, |
uintptr_t | signal, | ||
uel_llist_t * | listeners, | ||
void * | params | ||
) |
Configures a signal event.
event | The event to be configured |
signal | The integer value that identifies this signal |
listeners | The listeners associated to this signal |
params | The parameters associated with this signal emission |
void uel_event_config_signal_listener | ( | uel_event_t * | event, |
uel_closure_t * | closure, | ||
bool | repeating | ||
) |
Configures a signal listener event.
event | The event to be configured |
closure | The closure to be invoked when the event is run |
repeating | Intructs the system whether should this event be disposed of after processing |
void uel_event_config_timer | ( | uel_event_t * | event, |
uint16_t | timeout_in_ms, | ||
bool | repeating, | ||
bool | immediate, | ||
uel_closure_t * | closure, | ||
void * | value, | ||
uint32_t | current_time | ||
) |
Configures a timer event.
event | The event to be configured |
timeout_in_ms | The delay to process this event. If the event is repeating, this defines the interval between successive executions. |
repeating | If this flag is set, the event will not be destroyed after execution. Instead it will be put on the schedule queue. |
immediate | If this flag is set, a recurring timer will be immediately enqueued for processing. One-shot timers will ignore this setting. |
closure | The closure to be invoked when the timer expires |
value | The value to supply to the closure as parameters when it is invoked |
current_time | The current value set in the system counter. |
void uel_event_observer_cancel | ( | uel_event_t * | event | ) |
Cancels an observer.
event | The observer event to be cancelled |
void uel_event_timer_cancel | ( | uel_event_t * | event | ) |
Cancels a timer event.
event | The timer event to be cancelled |
void uel_event_timer_pause | ( | uel_event_t * | event | ) |
Pauses a timer event.
event | The timer event to be paused |
void uel_event_timer_resume | ( | uel_event_t * | event | ) |
Resumes a paused timer event.
event | The timer event to be resumed |