diff options
author | Guangxiong Lin <[email protected]> | 2022-12-09 16:46:49 +0800 |
---|---|---|
committer | Guangxiong Lin <[email protected]> | 2022-12-09 19:39:08 +0800 |
commit | 49839c88a98d3798f7b18c58f54f26f36cacff38 (patch) | |
tree | 5cb4ee13f9bdb0ef25e39a07a628f6f16da18e87 /eventloop.h | |
parent | 0457119acb36b89b6f2f4534fe8ad94b19540bbd (diff) | |
download | tinyserver-49839c88a98d3798f7b18c58f54f26f36cacff38.tar.gz tinyserver-49839c88a98d3798f7b18c58f54f26f36cacff38.tar.bz2 tinyserver-49839c88a98d3798f7b18c58f54f26f36cacff38.zip |
Implement a simple thread pool and refactor
Refactor
Diffstat (limited to 'eventloop.h')
-rw-r--r-- | eventloop.h | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/eventloop.h b/eventloop.h deleted file mode 100644 index 9aafb68..0000000 --- a/eventloop.h +++ /dev/null @@ -1,31 +0,0 @@ -#include <sys/epoll.h> - -#include "tsocket.h" - -#ifndef __EVENT_LOOP_H -#define __EVENT_LOOP_H - -#define EVENT_LOOP_MAX_EVENTS 1024 - -struct eventLoop { - int epollfd; - struct epoll_event events[EVENT_LOOP_MAX_EVENTS]; - int size; -}; - -struct event { - int fd; - void *data; - int (*handle)(void *data); - void (*delete)(void *data); -}; - -struct eventLoop *eventLoopNew(); -int eventLoopWait(struct eventLoop *el, int timeout); -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); -struct event *eventNew(void *data, int fd, void (*handle), void (*delete)); - -#endif |