timer_setcb — Sets callback to be invoked
#include <timer.h>
void timer_setcb ( | timer, | |
cb); |
timer_t * timer;event_xhandle_t cb;timerpointer to the timer object.
cbcallback function to be invoked when the timer expires.
Sets the callback to be invoked when a timer expires. To remove a
previous callback set on the timer, set cb to NULL.
It is the caller's responsibility to ensure that the timer
structure is not de-allocated as long as the callback is
registered. It is generally better to make the timer structure
instance a global or a static local.
The callback accepts a pointer to a timer (the timer for which the callback was registered) as argument and does not return values. An example callback is shown below.