Instrument Neutral Distributed Interface INDI  2.0.2
eventloop.h
Go to the documentation of this file.
1 #if 0
2 INDI
3 Copyright (C) 2003 Elwood C. Downey
4 2022 Ludovic Pollet
5 
6 This library is free software;
7 you can redistribute it and / or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation;
10 either
11 version 2.1 of the License, or (at your option) any later version.
12 
13 This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY;
15 without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
18 
19 You should have received a copy of the GNU Lesser General Public
20 License along with this library;
21 if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110 - 1301 USA
23 
24 #endif
25 
26 #pragma once
27 
33 /* signature of a callback, workproc and timer function */
34 
38 typedef void(CBF)(int fd, void *);
39 
43 typedef void(WPF)(void *);
44 
48 typedef void(TCF)(void *);
49 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 
57 extern void eventLoop();
58 
66 extern int addCallback(int fd, CBF *fp, void *ud);
67 
72 extern void rmCallback(int cid);
73 
80 extern int addWorkProc(WPF *fp, void *ud);
81 
86 extern void rmWorkProc(int wid);
87 
95 extern int addTimer(int ms, TCF *fp, void *ud);
96 
104 extern int addPeriodicTimer(int ms, TCF *fp, void *ud);
105 
111 extern int remainingTimer(int tid);
112 
118 extern int nsecRemainingTimer(int tid);
119 
124 extern void rmTimer(int tid);
125 
130 extern void addImmediateWork(TCF * fp, void *ud);
131 
132 /* utility functions */
133 extern int deferLoop(int maxms, int *flagp);
134 extern int deferLoop0(int maxms, int *flagp);
135 
136 #ifdef __cplusplus
137 }
138 #endif
void eventLoop()
Main calls this when ready to hand over control.
Definition: eventloop.c:105
int remainingTimer(int tid)
Definition: eventloop.c:311
void rmCallback(int cid)
Definition: eventloop.c:189
void rmWorkProc(int wid)
Definition: eventloop.c:356
void() WPF(void *)
Signature of a work procedure function.
Definition: eventloop.h:43
int addWorkProc(WPF *fp, void *ud)
Definition: eventloop.c:329
int nsecRemainingTimer(int tid)
void rmTimer(int tid)
Definition: eventloop.c:286
int addTimer(int ms, TCF *fp, void *ud)
Definition: eventloop.c:248
int addPeriodicTimer(int ms, TCF *fp, void *ud)
Definition: eventloop.c:253
void() CBF(int fd, void *)
Signature of a callback function.
Definition: eventloop.h:38
void addImmediateWork(TCF *fp, void *ud)
Definition: eventloop.c:524
int deferLoop0(int maxms, int *flagp)
Definition: eventloop.c:141
int deferLoop(int maxms, int *flagp)
Definition: eventloop.c:118
void() TCF(void *)
Signature of a timer function.
Definition: eventloop.h:48
int addCallback(int fd, CBF *fp, void *ud)
Definition: eventloop.c:161
int fd
Definition: intelliscope.c:43
Namespace to encapsulate INDI client, drivers, and mediator classes.