00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __EDELIB_LISTENER_H__
00022 #define __EDELIB_LISTENER_H__
00023
00024 #include "edelib-global.h"
00025
00026 EDELIB_NS_BEGIN
00027
00028 enum {
00029 LISTENER_READ = 1,
00030 LISTENER_WRITE = 4,
00031 LISTENER_EXCEPT = 8
00032 };
00033
00051 EDELIB_API void listener_add_fd(int fd, int when, void(*cb)(int, void*), void* arg = 0);
00052
00056 EDELIB_API inline void listener_add_fd(int fd, void(*cb)(int, void*), void* arg = 0) {
00057 listener_add_fd(fd, LISTENER_READ, cb, arg);
00058 }
00059
00066 EDELIB_API void listener_remove_fd(int fd, int when);
00067
00071 EDELIB_API inline void listener_remove_fd(int fd) {
00072 listener_remove_fd(fd, LISTENER_READ);
00073 }
00074
00087 EDELIB_API double listener_wait(double t);
00088
00092 EDELIB_API inline int listener_wait(void) {
00093
00094 return (int)listener_wait(1e20);
00095 }
00096
00097 EDELIB_NS_END
00098 #endif