µEvLoop
A fast and lightweight event loop aimed at embedded platforms in C99.
scheduler.h
Go to the documentation of this file.
1 
6 #ifndef UEL_SCHEDULER_H
7 #define UEL_SCHEDULER_H
8 
10 #include <stdint.h>
12 
16 #include "uevloop/utils/closure.h"
17 
27 typedef struct uel_scheduler uel_scheduer_t;
35  uel_llist_t timer_list;
36 
44  uel_llist_t pause_list;
45 
46  uel_syspools_t *pools;
47  uel_sysqueues_t *queues;
48 
50  volatile uint32_t timer;
51 };
52 
59 void uel_sch_init(
60  uel_scheduer_t *scheduler,
61  uel_syspools_t *pools,
62  uel_sysqueues_t *queues
63 );
64 
73 uel_event_t *uel_sch_run_later(
74  uel_scheduer_t *scheduler,
75  uint16_t timeout_in_ms,
76  uel_closure_t closure,
77  void *value
78 );
79 
80 
91 uel_event_t *uel_sch_run_at_intervals(
92  uel_scheduer_t *scheduler,
93  uint16_t interval_in_ms,
94  bool immediate,
95  uel_closure_t closure,
96  void *value
97 );
98 
106 void uel_sch_manage_timers(uel_scheduer_t *scheduler);
107 
113 void uel_sch_update_timer(uel_scheduer_t *scheduler, uint32_t timer);
114 
115 #endif /* UEL_SCHEDULER_H */
linked-list.h
Defines a simple implementation of linked lists and functions to manipulate it.
uel_scheduler::pools
uel_syspools_t * pools
Reference to the system's pools.
Definition: scheduler.h:46
closure.h
Defines closures, objects that bind functions to creating and calling contexts.
uel_sch_init
void uel_sch_init(uel_scheduer_t *scheduler, uel_syspools_t *pools, uel_sysqueues_t *queues)
Initialises a scheduler object.
uel_scheduler::pause_list
uel_llist_t pause_list
Paused timers linked list.
Definition: scheduler.h:44
uel_scheduler
The scheduler object.
Definition: scheduler.h:28
uel_scheduler::queues
uel_sysqueues_t * queues
Reference to the system's queues.
Definition: scheduler.h:47
uel_sch_run_later
uel_event_t * uel_sch_run_later(uel_scheduer_t *scheduler, uint16_t timeout_in_ms, uel_closure_t closure, void *value)
Enqueues a closure for later execution.
uel_scheduler::timer
volatile uint32_t timer
Internal timer. Must be updated via uel_sch_update_timer()
Definition: scheduler.h:50
uel_sch_run_at_intervals
uel_event_t * uel_sch_run_at_intervals(uel_scheduer_t *scheduler, uint16_t interval_in_ms, bool immediate, uel_closure_t closure, void *value)
Enqueues a closure for execution at intervals.
uel_sch_update_timer
void uel_sch_update_timer(uel_scheduer_t *scheduler, uint32_t timer)
Updates the internal time counter.
uel_scheduler::timer_list
uel_llist_t timer_list
Scheduled timers linked list.
Definition: scheduler.h:35
system-queues.h
A container for the system's internal queues.
system-pools.h
A container for the system's internal pools.
uel_sch_manage_timers
void uel_sch_manage_timers(uel_scheduer_t *scheduler)
Enqueue timers that are due to be processed in the event queue.