src/server/daemon/event.c

changeset 552
4ed0e46aa9dc
parent 547
280bf87c8689
child 555
66b0accda0a8
--- a/src/server/daemon/event.c	Fri Aug 16 16:59:05 2024 +0200
+++ b/src/server/daemon/event.c	Fri Aug 16 18:09:05 2024 +0200
@@ -78,11 +78,25 @@
     return ret;
 }
 
+void evhandler_shutdown(EVHandler *h) {
+    for(int i=0;i<h->numins;i++) {
+        ev_instance_shutdown(h->instances[i]);
+    }
+}
+
 void evhandler_close(EVHandler *h) {
     for(int i=0;i<h->numins;i++) {
         ev_instance_close(h->instances[i]);
     }
-    h->numins = 0;
+}
+
+void evhandler_wait_and_destroy(EVHandler *h) {
+    for(int i=0;i<h->numins;i++) {
+        ev_instance_wait(h->instances[i]);
+    }
+    
+    free(h->instances);
+    free(h);
 }
 
 /*

mercurial