--- a/src/server/daemon/event_linux.c Fri Aug 16 16:59:05 2024 +0200 +++ b/src/server/daemon/event_linux.c Fri Aug 16 18:09:05 2024 +0200 @@ -31,6 +31,7 @@ #include <errno.h> #include <sys/epoll.h> #include <sys/eventfd.h> +#include <signal.h> #include <cx/array_list.h> #include <cx/linked_list.h> @@ -92,17 +93,22 @@ return NULL; } - SYS_THREAD t = systhread_start( + handler->thr = systhread_start( 0, 0, (thrstartfunc)ev_handle_events, handler); - systhread_detach(t); } return ev; } +void ev_instance_wait(EventHandler *h) { + EventHandlerLinux *ev = (EventHandlerLinux*)h; + void *ret; + pthread_join(ev->thr, &ret); +} + static volatile int ev_close = 0; void ev_instance_close(EventHandler *h) { @@ -254,7 +260,7 @@ loop_ctn = 0; } } - + // epoll fd is already closed ev_queue_free(ev->queue_begin);