wintimer.h File Reference

Functions related to setting and executing timers. More...

Go to the source code of this file.

Typedefs

typedef int(*) win_timerfunc_t (void *app_data)
 Function signature for a timer callback.

Functions

void win_add_timer (win_timerfunc_t func, void *app_data, int interval_ms, int periodic)
 Adds a timer to call a registered callback function.
void win_add_timer_event (int event_num, void *event_data, int interval_ms, int periodic)
 Adds a timer to generate events on the event queue.
void win_remove_timer (win_timerfunc_t func, void *app_data)
 Removes a callback-style timer.
void win_remove_timer_event (int event_num, void *event_data)
 Removes an event-style timer.


Detailed Description

Functions related to setting and executing timers.

Timers provide a way for an application using the HPGCC window system to perform periodic tasks, such as updating a clock, progressing to the next frame of an animation, or flashing a text cursor.

Definition in file wintimer.h.


Typedef Documentation

typedef int(*) win_timerfunc_t(void *app_data)

Function signature for a timer callback.

Parameters:
app_data A data field with arbitrary contents. This value is passed to win_add_timer, and is returned to the callback function when a timer fires.
Returns:
Zero if the timer should continue firing; non-zero to drop the timer.

Definition at line 55 of file wintimer.h.


Function Documentation

void win_add_timer ( win_timerfunc_t  func,
void *  app_data,
int  interval_ms,
int  periodic 
)

Adds a timer to call a registered callback function.

Parameters:
func Pointer to the timer callback function.
app_data An arbitrary data field that is kept, and passed to the callback function every time it is invoked.
interval_ms The interval between successive calls to the callback function, measured in milliseconds.
periodic If non-zero, then interval_ms specifies the period of the repetitive action. If zero, then interval_ms is the delay between actions. The difference is that when periodic is zero, certain error terms - such as the time taken to execute the callback, and any lateness of the callback being run, are cumulative. When periodic is non-zero, the next delay is shortened to correct for that kind of error, so the error does not accumulate.

void win_add_timer_event ( int  event_num,
void *  event_data,
int  interval_ms,
int  periodic 
)

Adds a timer to generate events on the event queue.

Parameters:
event_num The event number to generate when the timer fires.
event_data An arbitrary data field that is kept, and passed to the event when it is delivered.
interval_ms The interval between successive calls to the callback function, measured in milliseconds.
periodic If non-zero, then interval_ms specifies the period of the repetitive action. If zero, then interval_ms is the delay between actions. The difference is that when periodic is zero, certain error terms - such as the time taken to execute the callback, and any lateness of the callback being run, are cumulative. When periodic is non-zero, the next delay is shortened to correct for that kind of error, so the error does not accumulate.

void win_remove_timer ( win_timerfunc_t  func,
void *  app_data 
)

Removes a callback-style timer.

There are two ways to remove a timer. One way is to call this function to remove it explicitly. The other is to return a non-zero value from the timer callback itself.

Parameters:
func The callback function to remove
app_data The data field for the callback to remove

void win_remove_timer_event ( int  event_num,
void *  event_data 
)

Removes an event-style timer.

There are two ways to remove an event timer. One way is to call this function to remove it explicitly. The other is to return a non-zero value from an event handler registered for that event.

Parameters:
event_num The event number of the event timer to remove
event_data The event data field for the event timer to remove


Generated on Fri Feb 16 16:43:17 2007 for HPGCCWindows by  doxygen 1.5.0