Timers


Typedefs

typedef implementation_defined os_timer_t
typedef void(* os_timer_func_t )(void *arg)

Functions

void os_timer_init (os_timer_t *timer, os_timer_func_t func, void *arg)
void os_timer_set (os_timer_t *timer, unsigned long expires_ms)
void os_timer_cancel (os_timer_t *timer)

Detailed Description

A timer is an object which calls a user-supplied function at some future time (the expiry time). Timers may be cancelled before they expire.

Typedef Documentation

typedef void(* os_timer_func_t)(void *arg)

Timer expiry function.

The function called when a timer expires must be of this type.

Parameters:
arg the argument supplied when the timer was initialized.

typedef implementation_defined os_timer_t

Implementation defined timer object.


Function Documentation

void os_timer_cancel ( os_timer_t timer  ) 

Cancel a timer.

This cancels a timer that was previously started. If the timer has already expired this has no effect.

Callable from: any context.

Note:
The timer function may still be running after this function returns.
Parameters:
timer the timer to stop.

void os_timer_init ( os_timer_t timer,
os_timer_func_t  func,
void *  arg 
)

Initialize a timer object.

Callable from: thread context.

Parameters:
timer the timer to initialize.
func the function to call when the timer expires.
arg the argument to pass to func.

void os_timer_set ( os_timer_t timer,
unsigned long  expires_ms 
)

Set a timer's expiry time.

This sets the time at which the timer will expire. If the timer is already set (but not expired) it is cancelled and reset with the new time. If the timer has expired, the timer is reset.

Callable from: any context.

Parameters:
timer the timer to start.
expires_ms elapsed time (in milliseconds) until the timer expires.


Generated on Wed Oct 27 15:14:03 2010 for oska by  doxygen 1.5.5