44#include <DoubleList.h>
48#define BA_TIMER_SLOTS 32
115 int reset(
size_t tkey,
U32 milliSec);
131 DoubleList slots[BA_TIMER_SLOTS];
BA_API int BaTimer_reset(BaTimer *o, size_t tkey, U32 milliSec)
Replace an existing event's delay while preserving its key and callback.
BA_API size_t BaTimer_set(BaTimer *o, BaTimer_CB cb, void *data, U32 milliSec)
Schedule an event; the manager acquires its mutex if needed.
BA_API void BaTimer_destructor(BaTimer *o)
Stop and release a timer manager's worker and queued events.
BaTimer BaTimer
Timer manager used for one-shot and periodic callbacks.
BA_API int BaTimer_cancel(BaTimer *o, size_t tkey)
Cancel an event; its application data is not freed.
BA_API void BaTimer_constructor(BaTimer *o, ThreadMutex *mutex, int stackSize, U32 ticklen, ThreadPriority priority, AllocatorIntf *alloc)
Initialize and start a timer manager.
BaBool(* BaTimer_CB)(void *data)
Timer callback function.
Definition: BaTimer.h:57
ThreadPriority
Portable priority choices, mapped to the target operating system.
Definition: ThreadLib.h:61
uint16_t U16
Unsigned 16-bit integer.
Definition: GenPrimT.h:91
uint32_t U32
Unsigned 32-bit integer.
Definition: GenPrimT.h:93
int16_t S16
Signed 16-bit integer.
Definition: GenPrimT.h:83
U8 BaBool
Boolean stored in an unsigned byte; FALSE is zero and TRUE is one.
Definition: GenPrimT.h:118
Memory allocation and deallocation Interface class.
Definition: AllocatorIntf.h:98
Timer manager used for one-shot and periodic callbacks.
Definition: BaTimer.h:67
BaTimer(ThreadMutex *mutex, int stackSize, U32 ticklen=10, ThreadPriority priority=ThreadPrioNormal, AllocatorIntf *alloc=0)
Create a BaTimer object and its worker thread.
Definition: BaTimer.h:181
~BaTimer()
Stop the worker and discard outstanding timer events without calling their callbacks.
Definition: BaTimer.h:185
size_t set(BaTimer_CB cb, void *data, U32 milliSec)
Create a timer event.
Definition: BaTimer.h:188
int reset(size_t tkey, U32 milliSec)
Resets the timer.
Definition: BaTimer.h:191
int cancel(size_t tkey)
Cancels the timer.
Definition: BaTimer.h:194
Self-adjusting tree of caller-owned nodes, with unique keys.
Definition: SplayTree.h:109
A mutual exclusion class.
Definition: ThreadLib.h:196
A simple thread class.
Definition: ThreadLib.h:261