Public interface to INDI's eventloop mechanism.
More...
Go to the source code of this file.
|
| typedef void() | CBF(int fd, void *) |
| | Signature of a callback function.
|
| |
| typedef void() | WPF(void *) |
| | Signature of a work procedure function.
|
| |
| typedef void() | TCF(void *) |
| | Signature of a timer function.
|
| |
|
| void | eventLoop () |
| | Main calls this when ready to hand over control.
|
| |
| int | addCallback (int fd, CBF *fp, void *ud) |
| |
| void | rmCallback (int cid) |
| |
| int | addWorkProc (WPF *fp, void *ud) |
| |
| void | rmWorkProc (int wid) |
| |
| int | addTimer (int ms, TCF *fp, void *ud) |
| |
| int | addPeriodicTimer (int ms, TCF *fp, void *ud) |
| |
| int | remainingTimer (int tid) |
| |
| int | nsecRemainingTimer (int tid) |
| |
| void | rmTimer (int tid) |
| |
| void | addImmediateWork (TCF *fp, void *ud) |
| |
| int | deferLoop (int maxms, int *flagp) |
| |
| int | deferLoop0 (int maxms, int *flagp) |
| |
Public interface to INDI's eventloop mechanism.
- Author
- Elwood C. Downey
Definition in file eventloop.h.
◆ CBF
Signature of a callback function.
Definition at line 38 of file eventloop.h.
◆ TCF
Signature of a timer function.
Definition at line 48 of file eventloop.h.
◆ WPF
Signature of a work procedure function.
Definition at line 43 of file eventloop.h.
◆ addCallback()
| int addCallback |
( |
int |
fd, |
|
|
CBF * |
fp, |
|
|
void * |
ud |
|
) |
| |
|
extern |
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().
Definition at line 165 of file eventloop.c.
◆ addImmediateWork()
| void addImmediateWork |
( |
TCF * |
fp, |
|
|
void * |
ud |
|
) |
| |
|
extern |
Register a given function to be called once after the current loop
- Parameters
-
| fp | a pointer to the callback function. |
| ud | a pointer to be passed to the callback function when called. |
Definition at line 528 of file eventloop.c.
◆ addPeriodicTimer()
| int addPeriodicTimer |
( |
int |
ms, |
|
|
TCF * |
fp, |
|
|
void * |
ud |
|
) |
| |
|
extern |
Register a new periodic timer function, fp, to be called with ud as argument after ms.
- 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().
Definition at line 257 of file eventloop.c.
◆ addTimer()
| int addTimer |
( |
int |
ms, |
|
|
TCF * |
fp, |
|
|
void * |
ud |
|
) |
| |
|
extern |
Register a new single-shot timer function, fp, to be called with ud as argument after ms.
- 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().
Definition at line 252 of file eventloop.c.
◆ addWorkProc()
| int addWorkProc |
( |
WPF * |
fp, |
|
|
void * |
ud |
|
) |
| |
|
extern |
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().
Definition at line 333 of file eventloop.c.
◆ deferLoop()
| int deferLoop |
( |
int |
maxms, |
|
|
int * |
flagp |
|
) |
| |
|
extern |
◆ deferLoop0()
| int deferLoop0 |
( |
int |
maxms, |
|
|
int * |
flagp |
|
) |
| |
|
extern |
◆ eventLoop()
Main calls this when ready to hand over control.
Definition at line 109 of file eventloop.c.
◆ nsecRemainingTimer()
| int nsecRemainingTimer |
( |
int |
tid | ) |
|
|
extern |
Returns the timer's remaining value in nanoseconds left until the timeout.
- Parameters
-
- Returns
- If the timer not exists, the returned value will be -1.
◆ remainingTimer()
| int remainingTimer |
( |
int |
tid | ) |
|
|
extern |
Returns the timer's remaining value in milliseconds left until the timeout.
- Parameters
-
- Returns
- If the timer not exists, the returned value will be -1.
Definition at line 315 of file eventloop.c.
◆ rmCallback()
| void rmCallback |
( |
int |
cid | ) |
|
|
extern |
Remove a callback function.
- Parameters
-
Definition at line 193 of file eventloop.c.
◆ rmTimer()
◆ rmWorkProc()
| void rmWorkProc |
( |
int |
wid | ) |
|
|
extern |