From 1c0481869fc680ea19627d8babec6de9a6784eb7 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Tue, 13 Jun 2023 03:31:05 +0200 Subject: event_loop: add event_loop_add_once --- src/worker.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/worker.c') diff --git a/src/worker.c b/src/worker.c index 8b2af56..725fad7 100644 --- a/src/worker.c +++ b/src/worker.c @@ -19,6 +19,7 @@ #include "run_queue.h" #include "signal.h" +#include #include #include @@ -107,10 +108,6 @@ static int worker_handle_run(const struct msg *request, UNUSED struct msg **resp if (ret < 0) goto free_output; - /* Close the descriptor and remove it from the event loop. - * poll(2) is too confusing, honestly. */ - ret = EVENT_LOOP_REMOVE; - free_output: proc_output_free(&result); @@ -214,8 +211,8 @@ int worker_main(struct worker *worker) if (ret < 0) return ret; - ret = cmd_dispatcher_add_to_event_loop(worker->cmd_dispatcher, worker->event_loop, - fd); + ret = event_loop_add_once(worker->event_loop, fd, POLLIN, + cmd_dispatcher_handle_event, worker->cmd_dispatcher); if (ret < 0) return ret; -- cgit v1.2.3