summaryrefslogtreecommitdiff
path: root/poll.c
diff options
context:
space:
mode:
authorNiels Provos <provos@gmail.com>2007-03-10 06:37:53 +0000
committerNiels Provos <provos@gmail.com>2007-03-10 06:37:53 +0000
commit41b7cbc38105a540ade7d02bb6137898a94abc89 (patch)
tree5a6081df26cb1f269b72bee380e2c1190817c401 /poll.c
parenta968da742598e9e6720c883cb78b1f0f6e912ae2 (diff)
downloadlibevent-41b7cbc38105a540ade7d02bb6137898a94abc89.tar.gz
more the signal base into the event base; this removes global state and makes signals
work better with threading; from Wouter Wijngaards small fixes for kqueue and style by me svn:r351
Diffstat (limited to 'poll.c')
-rw-r--r--poll.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/poll.c b/poll.c
index 14ca8453..84885984 100644
--- a/poll.c
+++ b/poll.c
@@ -54,8 +54,6 @@
#include "evsignal.h"
#include "log.h"
-extern volatile sig_atomic_t evsignal_caught;
-
struct pollop {
int event_count; /* Highest number alloc */
int nfds; /* Size of event_* */
@@ -68,12 +66,12 @@ struct pollop {
* "no entry." */
};
-void *poll_init (void);
+void *poll_init (struct event_base *);
int poll_add (void *, struct event *);
int poll_del (void *, struct event *);
int poll_recalc (struct event_base *, void *, int);
int poll_dispatch (struct event_base *, void *, struct timeval *);
-void poll_dealloc (void *);
+void poll_dealloc (struct event_base *, void *);
const struct eventop pollops = {
"poll",
@@ -86,7 +84,7 @@ const struct eventop pollops = {
};
void *
-poll_init(void)
+poll_init(struct event_base *base)
{
struct pollop *pollop;
@@ -97,7 +95,7 @@ poll_init(void)
if (!(pollop = calloc(1, sizeof(struct pollop))))
return (NULL);
- evsignal_init();
+ evsignal_init(base);
return (pollop);
}
@@ -164,10 +162,11 @@ poll_dispatch(struct event_base *base, void *arg, struct timeval *tv)
return (-1);
}
- evsignal_process();
+ evsignal_process(base);
return (0);
- } else if (evsignal_caught)
- evsignal_process();
+ } else if (base->sig.evsignal_caught) {
+ evsignal_process(base);
+ }
event_debug(("%s: poll reports %d", __func__, res));
@@ -370,10 +369,11 @@ poll_del(void *arg, struct event *ev)
}
void
-poll_dealloc(void *arg)
+poll_dealloc(struct event_base *base, void *arg)
{
struct pollop *pop = arg;
+ evsignal_dealloc(base);
if (pop->event_set)
free(pop->event_set);
if (pop->event_r_back)