diff options
Diffstat (limited to 'eventloop.h')
-rw-r--r-- | eventloop.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/eventloop.h b/eventloop.h index 4dd7f6e..490d515 100644 --- a/eventloop.h +++ b/eventloop.h @@ -13,9 +13,19 @@ struct eventLoop { int size; }; +struct event { + int fd; + struct eventLoop *el; + void *data; + void (*handle)(struct event *ev); + void (*delete)(struct event *ev); +}; + struct eventLoop *eventLoopNew(); -int eventLoopAddSocket(struct eventLoop *el, struct tsocket *sock, int flag); int eventLoopWait(struct eventLoop *el, int timeout); -struct tsocket *eventLoopGetSocket(struct eventLoop *el, int index); +int eventLoopAdd(struct eventLoop *el, struct event *ev, int flag); +int eventLoopDel(struct eventLoop *el, struct event *ev); +struct event *eventLoopGet(struct eventLoop *el, int index); +void eventLoopLoop(struct eventLoop *el); #endif |