Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

Timer Functions.
[Common API]


Data Structures

struct  TimerData
 Represents a timer. More...

Defines

#define DIFF_TICK(a, b)   ((int)((a)-(b)))
#define TIMER_FUNC(func)   int func(int tid, unsigned int tick, intptr_t id, intptr_t data)
 Declares a timer callback function.

Functions

void init_gettick (void)
unsigned int gettick_nocache (void)
int add_timer (unsigned int tick, int(*func)(int, unsigned int, intptr_t, intptr_t), intptr_t id, intptr_t data)
 Adds a timed callback.
int add_timer_interval (unsigned int tick, int(*func)(int, unsigned int, intptr_t, intptr_t), intptr_t id, intptr_t data, int interval)
 Adds a timed callback that is called every a given interval.
int delete_timer (int id, int(*func)(int, unsigned int, intptr_t, intptr_t))
 Deletes a timer.
unsigned int addtick_timer (int tid, int added_tick)
 Adds delay into a timer.
TimerDataget_timer (int tid)
 Gets the timer data.
int do_timer (void)
 Executes all timed callback when the conditions are satisfied.
int add_timer_func_list (int(*)(int, unsigned int, intptr_t, intptr_t), char *)
void timer_final ()

Variables

unsigned int gettick_cache
 The current tick.

Function Documentation

int add_timer unsigned int  tick,
int(*)(int, unsigned int, intptr_t, intptr_t)  func,
intptr_t  id,
intptr_t  data
 

Adds a timed callback.

Example usage: add_timer(gettick_cache + 3000, some_func, id, 0);

Returns:
The assigned ID of this timer.
Parameters:
tick The time when function will called in milisecond.
func The callback function.
id Specific id, usually the session data.
data The data to be passed to callback.

int add_timer_interval unsigned int  tick,
int(*)(int, unsigned int, intptr_t, intptr_t)  func,
intptr_t  id,
intptr_t  data,
int  interval
 

Adds a timed callback that is called every a given interval.

Returns:
The assigned ID of this timer.
Parameters:
tick The time when function will be called in milisecond.
func The callback function.
id The specific id of this timer.
data Data to be passed to callback.
interval The interval in milisecond.

unsigned int addtick_timer int  tid,
int  added_tick
 

Adds delay into a timer.

Parameters:
tid The ID assigned for this timer.
added_tick The delay in milisecond.

int delete_timer int  id,
int(*)(int, unsigned int, intptr_t, intptr_t)  func
 

Deletes a timer.

Returns:
0 on success, -1 if timer does not exist, -2 on failure.
Parameters:
id The timer id.
func The callback function.

struct TimerData* get_timer int  tid  ) 
 

Gets the timer data.

Returns:
The timer data.
Parameters:
tid The ID assigned for this timer.
Todo:
Remove from header declaration, it should not be used outside.


Generated on Fri Apr 28 10:20:06 2006 for OpenAthena by  doxygen 1.4.4