From 349846cd411f0c6d45237c5794f9694cb6030489 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Tue, 13 Jun 2023 03:59:41 +0200 Subject: signal: remove the stupid add_to_event_loop wrapper --- src/server.c | 5 +++-- src/signal.c | 7 ------- src/signal.h | 7 +------ src/worker.c | 4 ++-- 4 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/server.c b/src/server.c index 0e771df..cd77dc8 100644 --- a/src/server.c +++ b/src/server.c @@ -19,6 +19,7 @@ #include "tcp_server.h" #include "worker_queue.h" +#include #include #include @@ -317,8 +318,8 @@ int server_create(struct server **_server, const struct settings *settings) goto destroy_event_loop; server->signalfd = ret; - ret = signalfd_add_to_event_loop(server->signalfd, server->event_loop, server_set_stopping, - server); + ret = event_loop_add(server->event_loop, server->signalfd, POLLIN, server_set_stopping, + server); if (ret < 0) goto close_signalfd; diff --git a/src/signal.c b/src/signal.c index 1f4a9cc..15d90ab 100644 --- a/src/signal.c +++ b/src/signal.c @@ -7,11 +7,9 @@ #include "signal.h" #include "compiler.h" -#include "event_loop.h" #include "file.h" #include "log.h" -#include #include #include #include @@ -89,8 +87,3 @@ void signalfd_destroy(int fd) { file_close(fd); } - -int signalfd_add_to_event_loop(int fd, struct event_loop *loop, event_handler handler, void *arg) -{ - return event_loop_add(loop, fd, POLLIN, handler, arg); -} diff --git a/src/signal.h b/src/signal.h index b049c3f..e48eff2 100644 --- a/src/signal.h +++ b/src/signal.h @@ -8,8 +8,6 @@ #ifndef __SIGNAL_H__ #define __SIGNAL_H__ -#include "event_loop.h" - #include int signal_set_mask(const sigset_t *new); @@ -18,10 +16,7 @@ int signal_block_all(sigset_t *old); int signal_block_sigterms(void); int signalfd_create(const sigset_t *); -void signalfd_destroy(int fd); - -int signalfd_add_to_event_loop(int fd, struct event_loop *, event_handler handler, void *arg); - int signalfd_create_sigterms(void); +void signalfd_destroy(int fd); #endif diff --git a/src/worker.c b/src/worker.c index 725fad7..03a83c6 100644 --- a/src/worker.c +++ b/src/worker.c @@ -153,8 +153,8 @@ int worker_create(struct worker **_worker, const struct settings *settings) goto destroy_event_loop; worker->signalfd = ret; - ret = signalfd_add_to_event_loop(worker->signalfd, worker->event_loop, worker_set_stopping, - worker); + ret = event_loop_add(worker->event_loop, worker->signalfd, POLLIN, worker_set_stopping, + worker); if (ret < 0) goto close_signalfd; -- cgit v1.2.3