src/server/daemon/event.c

changeset 541
1e1fca11aaff
parent 490
d218607f5a7e
child 542
1327febf99c4
--- a/src/server/daemon/event.c	Sun Aug 11 10:09:20 2024 +0200
+++ b/src/server/daemon/event.c	Sun Aug 11 13:26:17 2024 +0200
@@ -27,6 +27,7 @@
  */
 
 #include <cx/hash_map.h>
+#include <cx/linked_list.h>
 #include "../util/atomic.h"
 
 #include "event.h"
@@ -118,3 +119,42 @@
     ws_atomic_inc32(&ev->current);
     return ev->instances[ins];
 }
+
+
+void ev_watchlist_add(EventHandler *h, EVWatchList *elm) {
+    watchlist_add(&h->watchlist_begin, &h->watchlist_end, elm);
+}
+
+void ev_watchlist_remove(EventHandler *h, EVWatchList *elm) {
+    watchlist_remove(&h->watchlist_begin, &h->watchlist_end, elm);
+}
+
+void ev_saf_return(EventHandler *h, Session *sn, Request *rq, int ret) {
+    h->fnreturn[h->numret++] = (EVReturn){ sn, rq, ret };
+}
+
+void watchlist_add(EVWatchList **begin, EVWatchList **end, EVWatchList *elm) {
+    cx_linked_list_add(
+            (void**)begin,
+            (void**)end,
+            offsetof(EVWatchList, prev),
+            offsetof(EVWatchList, next),
+            elm);
+}
+
+void watchlist_remove(EVWatchList **begin, EVWatchList **end, EVWatchList *elm) {
+    cx_linked_list_remove(
+            (void**)begin,
+            (void**)end,
+            offsetof(EVWatchList, prev),
+            offsetof(EVWatchList, next),
+            elm);
+}
+
+void watchlist_check(EventHandler *h, time_t t) {
+    if(t == 0) {
+        t = time(NULL);
+    }
+    
+    
+}

mercurial