diff options
author | Niels Provos <provos@gmail.com> | 2008-12-23 16:37:01 +0000 |
---|---|---|
committer | Niels Provos <provos@gmail.com> | 2008-12-23 16:37:01 +0000 |
commit | 02b2b4d1bee7dfd5d75d0a376ce64fc7298e350f (patch) | |
tree | 9290d648cbc4b21b4f36dc57817e15e6658be787 /event-internal.h | |
parent | 97cebce8fdc400401093f669a56e46bef518386e (diff) | |
download | libevent-02b2b4d1bee7dfd5d75d0a376ce64fc7298e350f.tar.gz |
Restructure the event backends so that they do not need to keep track of events themselves, as a side effect multiple events can use the same fd or signal.
svn:r972
Diffstat (limited to 'event-internal.h')
-rw-r--r-- | event-internal.h | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/event-internal.h b/event-internal.h index 84e898ac..d6ed4b12 100644 --- a/event-internal.h +++ b/event-internal.h @@ -40,6 +40,7 @@ extern "C" { /* mutually exclusive */ #define ev_signal_next _ev.ev_signal.ev_signal_next +#define ev_io_next _ev.ev_io.ev_io_next /* used only by signals */ #define ev_ncalls _ev.ev_signal.ev_ncalls @@ -48,18 +49,31 @@ extern "C" { struct eventop { const char *name; void *(*init)(struct event_base *); - int (*add)(void *, struct event *); - int (*del)(void *, struct event *); - int (*dispatch)(struct event_base *, void *, struct timeval *); - void (*dealloc)(struct event_base *, void *); + int (*add)(struct event_base *, evutil_socket_t fd, short old, short events); + int (*del)(struct event_base *, evutil_socket_t fd, short old, short events); + int (*dispatch)(struct event_base *, struct timeval *); + void (*dealloc)(struct event_base *); /* set if we need to reinitialize the event base */ int need_reinit; enum event_method_feature features; }; +/* used to map multiple events to the same underlying identifier */ +struct event_map { + void *entries; + int nentries; +}; + struct event_base { const struct eventop *evsel; void *evbase; + + /* signal handling info */ + const struct eventop *evsigsel; + void *evsigbase; + + struct evsignal_info sig; + int event_count; /* counts number of total events */ int event_count_active; /* counts number of active events */ @@ -70,8 +84,11 @@ struct event_base { struct event_list **activequeues; int nactivequeues; - /* signal handling info */ - struct evsignal_info sig; + /* for mapping io activity to events */ + struct event_map io; + + /* for mapping signal activity to events */ + struct event_map sigmap; struct event_list eventqueue; struct timeval event_tv; |