|
µEvLoop
A fast and lightweight event loop aimed at embedded platforms in C99.
|
The application module is a convenient top-level container for the system internals. More...
#include "uevloop/system/containers/system-pools.h"#include "uevloop/system/containers/system-queues.h"#include "uevloop/system/event-loop.h"#include "uevloop/system/scheduler.h"#include "uevloop/system/signal.h"#include "uevloop/utils/module.h"
Go to the source code of this file.
Data Structures | |
| struct | uel_application_t |
| Top-level container for µEvLoop'd application. More... | |
Typedefs | |
| typedef enum uel_app_event | uel_app_event_t |
| Alias to the uel_app_event enum. | |
Enumerations | |
| enum | uel_app_event { UEL_APP_READY = 0, UEL_APP_CRASHED, UEL_APP_IDLE, UEL_APP_EVENT_COUNT } |
| Events emitted by the application relay. Unused ATM. | |
Functions | |
| void | uel_app_init (uel_application_t *app) |
| Initialises an uel_application_t instance. More... | |
| void | uel_app_load (uel_application_t *app, uel_module_t **modules, size_t module_count) |
| Loads modules into an application and run their lifecycle hooks. More... | |
| uel_module_t * | uel_app_require (uel_application_t *app, size_t id) |
| Fetches a module from the app's registry. More... | |
| void | uel_app_tick (uel_application_t *app) |
| Ticks the application. More... | |
| void | uel_app_update_timer (uel_application_t *app, uint32_t timer) |
| Updates the internal timer of an application, located at the scheduler. More... | |
| uel_event_t * | uel_app_run_later (uel_application_t *app, uint16_t timeout_in_ms, uel_closure_t closure, void *value) |
| Enqueues a closure for later execution. More... | |
| uel_event_t * | uel_app_run_at_intervals (uel_application_t *app, uint16_t interval_in_ms, bool immediate, uel_closure_t closure, void *value) |
| Enqueues a closure for execution at intervals. More... | |
| void | uel_app_enqueue_closure (uel_application_t *app, uel_closure_t *closure, void *value) |
| Enqueues a closure to be invoked. More... | |
| uel_event_t * | uel_app_observe (uel_application_t *app, volatile uintptr_t *condition_var, uel_closure_t *closure) |
| Sets up an observer. More... | |
The application module is a convenient top-level container for the system internals.
| void uel_app_enqueue_closure | ( | uel_application_t * | app, |
| uel_closure_t * | closure, | ||
| void * | value | ||
| ) |
Enqueues a closure to be invoked.
Proxies the call to uel_evloop_enqueue_closure() with uel_application_t::event_loop as parameter.
| app | The uel_application_t instance |
| closure | The closure to be enqueued |
| value | The value to invoked the closure with |
| void uel_app_init | ( | uel_application_t * | app | ) |
Initialises an uel_application_t instance.
| app | The uel_application_t instance |
| void uel_app_load | ( | uel_application_t * | app, |
| uel_module_t ** | modules, | ||
| size_t | module_count | ||
| ) |
Loads modules into an application and run their lifecycle hooks.
| app | The application onto which to load the modules |
| modules | The modules to be loaded |
| module_count | The number of modules being loaded |
| uel_event_t* uel_app_observe | ( | uel_application_t * | app, |
| volatile uintptr_t * | condition_var, | ||
| uel_closure_t * | closure | ||
| ) |
Sets up an observer.
Proxies the call to uel_evloop_observe() with uel_application_t::event_loop as parameter.
| app | The uel_application_t instance |
| condition_var | The address of the value to be observed |
| closure | The closure to be invoked on change dection |
| uel_module_t* uel_app_require | ( | uel_application_t * | app, |
| size_t | id | ||
| ) |
Fetches a module from the app's registry.
| app | The application from where to fetch the module |
| id | The module ID to be fetched |
idth position in the registry | uel_event_t* uel_app_run_at_intervals | ( | uel_application_t * | app, |
| uint16_t | interval_in_ms, | ||
| bool | immediate, | ||
| uel_closure_t | closure, | ||
| void * | value | ||
| ) |
Enqueues a closure for execution at intervals.
Proxies the call to uel_sch_run_at_intervals() with uel_application_t::scheduler as parameter.
| app | The uel_application_t instance |
| interval_in_ms | The delay in milliseconds two executions of the closure |
| immediate | If this flag is set, the the event will be created with a due time to the current time. |
| closure | The closure to be invoked when the due time is reached |
| value | The value to invoked the closure with |
| uel_event_t* uel_app_run_later | ( | uel_application_t * | app, |
| uint16_t | timeout_in_ms, | ||
| uel_closure_t | closure, | ||
| void * | value | ||
| ) |
Enqueues a closure for later execution.
Proxies the call to uel_sch_run_later() with uel_application_t::scheduler as parameter.
| app | The uel_application_t instance |
| timeout_in_ms | The delay in milliseconds until the closure is run |
| closure | The closure to be invoked when the due time is reached |
| value | The value to invoked the closure with |
| void uel_app_tick | ( | uel_application_t * | app | ) |
Ticks the application.
Yields control to the application runtime. This will:
| app | The uel_application_t instance |
| void uel_app_update_timer | ( | uel_application_t * | app, |
| uint32_t | timer | ||
| ) |
Updates the internal timer of an application, located at the scheduler.
| app | The uel_application_t instance |
| timer | The current application timer, in milliseconds |
1.8.17