libamxp
1.4.0
Patterns C Implementation
|
Structure containing a scheduler. More...
#include <amxp_scheduler.h>
Data Fields | |
amxp_signal_mngr_t | sigmngr |
bool | use_local_time |
amxp_timer_t * | timer |
amxc_htable_t | items |
amxc_llist_t | ordered_items |
Structure containing a scheduler.
A scheduler can contain multiple schedule items (amxp_scheduler_item_t). Each time an item is added (using amxp_scheduler_set_cron_item, amxp_scheduler_set_weekly_item, amxp_scheduler_set_cron_begin_end_item, amxp_scheduler_set_weekly_begin_end_item), the list of items is updated and sorted again. The first item in the list is the item the will be triggered first.
A scheduler always works on the current time (UTC or local time). So make sure that time synchronization has happend before using a scheduler.
When NTP synchronization didn't happen yet, it is recommened to disable the scheduler and enable it again when time synchronization has happened.
A scheduler can be enabled or disabled using amxp_scheduler_enable.
A scheduler contains a signal manager. This signal manager will be used to emit the signals "trigger:ID", "start:ID", "stop:ID". (Here the ID is the schedule item identifier)
When these signals are emitted, the signal data will contain the schedule item identifier and the reason (trigger, start, stop). When the "start" signal is emitted, the signal data will also contain the duration in seconds before the "stop" signal is emitted.
Callback functions (slots) can be added using amxp_scheduler_connect or by using one of the amxp_slot_connect functions, and removed again using one of the amxp_slot_disconnect functions.
Definition at line 170 of file amxp_scheduler.h.
amxc_htable_t _scheduler::items |
Hash table containing all schedule items, used for look-up by identifier.
Definition at line 174 of file amxp_scheduler.h.
amxc_llist_t _scheduler::ordered_items |
A linked list containig all schedule items, sorted on next trigger time, smallest first.
Definition at line 175 of file amxp_scheduler.h.
amxp_signal_mngr_t _scheduler::sigmngr |
The scheduler signal manager
Definition at line 171 of file amxp_scheduler.h.
amxp_timer_t* _scheduler::timer |
The scheduler timer, this will be started using the calculated time until next event, when it expires a signal is emitted.
Definition at line 173 of file amxp_scheduler.h.
bool _scheduler::use_local_time |
When set to true, this scheduler will use local time to calculate the next trigger time, otherwise UTC is used.
Definition at line 172 of file amxp_scheduler.h.