diff options
author | fadhil riyanto <me@fadev.org> | 2024-09-27 20:10:50 +0700 |
---|---|---|
committer | fadhil riyanto <me@fadev.org> | 2024-09-27 20:10:50 +0700 |
commit | 85964a41fd991a40f28c770f542c15432eafb715 (patch) | |
tree | cbecb1d39968db96d071146c73015da96911fd34 | |
parent | 369b6484db835bf42f84b469a9c03631cfc06c4d (diff) |
add function that install fd into epoll instance
Signed-off-by: fadhil riyanto <me@fadev.org>
-rw-r--r-- | main.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -152,6 +152,14 @@ static void setup_epoll(struct server_ctx *srv_ctx) srv_ctx->epoll_fd = epoll_create1(EPOLL_CLOEXEC); } +static void install_fd2epoll(int intrest_fd, struct server_ctx *srv_ctx) +{ + epoll_ctl(srv_ctx->epoll_fd, EPOLL_CTL_ADD, intrest_fd, + srv_ctx->epoll_fd_queue[srv_ctx->epoll_fd_queue->i].eventmode); + + srv_ctx->epoll_fd_queue->i = srv_ctx->epoll_fd_queue->i + 1; +} + static int enter_eventloop(struct server_ctx *srv_ctx) { setup_epoll(srv_ctx); |