]> git.decadent.org.uk Git - ion3.git/blob - libmainloop/select.h
465f1340058d8b63dc6489a0a7f4bda5dc9caf19
[ion3.git] / libmainloop / select.h
1 /*
2  * ion/mainloop/select.h
3  * 
4  * Based on a contributed readfds code.
5  * 
6  * Ion is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation; either version 2.1 of the License, or
9  * (at your option) any later version.
10  */
11
12 #ifndef ION_LIBMAINLOOP_SELECT_H
13 #define ION_LIBMAINLOOP_SELECT_H
14
15 #include <stdlib.h>
16 #include <unistd.h>
17 #include <sys/time.h>
18 #include <libtu/obj.h>
19 #include <libtu/types.h>
20
21 INTRSTRUCT(WInputFd);
22
23 DECLSTRUCT(WInputFd){
24     int fd;
25     void *data;
26     void (*process_input_fn)(int fd, void *data);
27     WInputFd *next, *prev;
28 };
29
30 extern bool mainloop_register_input_fd(int fd, void *data,
31                                        void (*callback)(int fd, void *data));
32 extern void mainloop_unregister_input_fd(int fd);
33
34 extern void mainloop_select();
35
36 #endif /* ION_LIBMAINLOOP_SELECT_H */