summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/event.h
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs/src/event.h')
-rw-r--r--libglusterfs/src/event.h20
1 files changed, 13 insertions, 7 deletions
diff --git a/libglusterfs/src/event.h b/libglusterfs/src/event.h
index 7ed182492e2..3b3ab0e4b2f 100644
--- a/libglusterfs/src/event.h
+++ b/libglusterfs/src/event.h
@@ -20,15 +20,20 @@
struct event_pool;
struct event_ops;
+struct event_slot_poll;
+struct event_slot_epoll;
struct event_data {
- int fd;
int idx;
+ int gen;
} __attribute__ ((__packed__, __may_alias__));
typedef int (*event_handler_t) (int fd, int idx, void *data,
int poll_in, int poll_out, int poll_err);
+#define EVENT_EPOLL_TABLES 1024
+#define EVENT_EPOLL_SLOTS 1024
+
struct event_pool {
struct event_ops *ops;
@@ -36,12 +41,9 @@ struct event_pool {
int breaker[2];
int count;
- struct {
- int fd;
- int events;
- void *data;
- event_handler_t handler;
- } *reg;
+ struct event_slot_poll *reg;
+ struct event_slot_epoll *ereg[EVENT_EPOLL_TABLES];
+ int slots_used[EVENT_EPOLL_TABLES];
int used;
int changed;
@@ -65,6 +67,9 @@ struct event_ops {
int (*event_unregister) (struct event_pool *event_pool, int fd, int idx);
+ int (*event_unregister_close) (struct event_pool *event_pool, int fd,
+ int idx);
+
int (*event_dispatch) (struct event_pool *event_pool);
};
@@ -75,6 +80,7 @@ int event_register (struct event_pool *event_pool, int fd,
event_handler_t handler,
void *data, int poll_in, int poll_out);
int event_unregister (struct event_pool *event_pool, int fd, int idx);
+int event_unregister_close (struct event_pool *event_pool, int fd, int idx);
int event_dispatch (struct event_pool *event_pool);
#endif /* _EVENT_H_ */