kstars
Utility functions to add and remove callbacks, workprocs, and timers.
Functions | |
int | addCallback (int fd, CBF *fp, void *ud) |
int | addTimer (int ms, TCF *fp, void *ud) |
int | addWorkProc (WPF *fp, void *ud) |
void | rmCallback (int cid) |
void | rmTimer (int tid) |
void | rmWorkProc (int wid) |
Function Documentation
int addCallback | ( | int | fd, | |
CBF * | fp, | |||
void * | ud | |||
) |
Register a new callback, fp, to be called with ud as argument when fd is ready.
- Parameters:
-
fd file descriptor. fp a pointer to the callback function. ud a pointer to be passed to the callback function when called.
- Returns:
- a unique callback id for use with rmCallback().
int addTimer | ( | int | ms, | |
TCF * | fp, | |||
void * | ud | |||
) |
Register a new timer function, fp, to be called with ud as argument after ms.
Add to list in order of decreasing time from epoch, ie, last entry runs soonest. The timer will only invoke the callback function once. You need to call addTimer again if you want to repeat the process.
- Parameters:
-
ms timer period in milliseconds. fp a pointer to the callback function. ud a pointer to be passed to the callback function when called.
- Returns:
- a unique id for use with rmTimer().
int addWorkProc | ( | WPF * | fp, | |
void * | ud | |||
) |
Add a new work procedure, fp, to be called with ud when nothing else to do.
- Parameters:
-
fp a pointer to the work procedure callback function. ud a pointer to be passed to the callback function when called.
- Returns:
- a unique id for use with rmWorkProc().
void rmCallback | ( | int | cid | ) |
void rmTimer | ( | int | tid | ) |
Remove the timer with the given id, as returned from addTimer().
- Parameters:
-
tid the timer callback ID returned from addTimer().
void rmWorkProc | ( | int | wid | ) |
Remove the work procedure with the given id, as returned from addWorkProc().
- Parameters:
-
wid the work procedure callback ID returned from addWorkProc().