Fix connection_is_idle test for idleness
[pazpar2-moved-to-github.git] / src / eventl.h
index b31fca2..e53776c 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of Pazpar2.
-   Copyright (C) 2006-2009 Index Data
+   Copyright (C) 2006-2010 Index Data
 
 Pazpar2 is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free
@@ -28,6 +28,8 @@ typedef void (*IOC_CALLBACK)(struct iochan *i, int event);
 typedef int (*IOC_SOCKETFUN)(struct iochan *i);
 typedef int (*IOC_MASKFUN)(struct iochan *i);
 
+typedef struct iochan_man_s *iochan_man_t;
+
 typedef struct iochan
 {
     int fd;
@@ -44,10 +46,20 @@ typedef struct iochan
     int destroyed;
     time_t last_event;
     time_t max_idle;
-    
+    int this_event;
+    int thread_users;
+
+    iochan_man_t man;
+
     struct iochan *next;
 } *IOCHAN;
 
+
+iochan_man_t iochan_man_create(int no_threads);
+void iochan_add(iochan_man_t man, IOCHAN chan);
+void iochan_man_events(iochan_man_t man);
+void iochan_man_destroy(iochan_man_t *mp);
+
 #define iochan_destroy(i) (void)((i)->destroyed = 1)
 #define iochan_getfd(i) ((i)->fd)
 #define iochan_setfd(i, f) ((i)->fd = (f))
@@ -61,7 +73,6 @@ typedef struct iochan
 #define iochan_getfun(i) ((i)->fun)
 #define iochan_setfun(i, d) ((i)->fun = d)
 #define iochan_setevent(i, e) ((i)->force_event = (e))
-#define iochan_getnext(i) ((i)->next)
 #define iochan_settimeout(i, t) ((i)->max_idle = (t), (i)->last_event = time(0))
 #define iochan_activity(i) ((i)->last_event = time(0))
 #define iochan_setsocketfun(i, f) ((i)->socketfun = (f))
@@ -70,6 +81,14 @@ typedef struct iochan
 #define iochan_getmaskfun(i) ((i)->maskfun)
 
 IOCHAN iochan_create(int fd, IOC_CALLBACK cb, int flags);
-int event_loop(IOCHAN *iochans);
 
 #endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+