NAME

cxTimerAdd - register an interval timer

C SPECIFICATION

#include <cx/Timer.h>

void *cxTimerAdd(int ms, int retrip, void (*callback)(void *), void *client)

FORTRAN SPECIFICATION

integer function cxTimerAdd(ms, retrip, callback, client)
integer ms, retrip
integer client
integer callback

PARAMETERS

ms
The number of milliseconds of delay wanted.
retrip
Non-zero value means that this timer should reset itself and start timing down once it has tripped and called the user callback routine.
callback
The user callback routine. This subroutine is called by the control wrapper when the timer has expired.
client
Arbitrary client data. This value is passed to the user callback routine when the time expires.

DESCRIPTION

cxTimerAdd implements a timing facility for IRIS Explorer modules. A module may request that one of its callback routines be called after a delay, or be called periodically. cxTimerAdd returns an opaque pointer which can subsequently be used to remove the timer by using cxTimerRemove.

The first parameter, ms, says how many milliseconds to delay. Once that period has elapsed, the routine callback will be called from the control wrapper; it will be given the value of clientdata as its sole parameter. Once the user callback has returned, if retrip is non-zero, the timer will be set back to the value ms and timing will continue.

Because timing is performed as a part of the event processing loop within the control wrapper, if the timer expires while the user function is executing, and the user function retains control for a long period of time, the callback will not be called on schedule.

The following is an example of how to use this routine:

In this example, the function myCallback will be called from the control wrapper every 250 milliseconds.

Note:
This timing facility is not available to modules that link with the X Window System. Timing in those modules must be managed by XtAddTimeOut.

SEE ALSO

cxTimerRemove(3E), XtAddTimeOut(3X)
Last modified: Mon Nov 18 13:53:39 GMT 1996
[ Documentation Home ]
© The Numerical Algorithms Group Ltd, Oxford UK. 1996