summaryrefslogtreecommitdiff
path: root/poll.c
diff options
context:
space:
mode:
authorNiels Provos <provos@gmail.com>2004-11-25 09:50:18 +0000
committerNiels Provos <provos@gmail.com>2004-11-25 09:50:18 +0000
commit8773c4c96c47078ee502030daef36078bc0e75a4 (patch)
treec294c8b6524101f1f1cc5246311ff030a706ebde /poll.c
parent96a25ae6a2d4f63f1df483cd3d49b779175031b0 (diff)
downloadlibevent-8773c4c96c47078ee502030daef36078bc0e75a4.tar.gz
make libevent thread-safe; first cut
svn:r122
Diffstat (limited to 'poll.c')
-rw-r--r--poll.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/poll.c b/poll.c
index bba594d4..ec2366d8 100644
--- a/poll.c
+++ b/poll.c
@@ -37,6 +37,7 @@
#include <sys/_time.h>
#endif
#include <sys/queue.h>
+#include <sys/tree.h>
#include <poll.h>
#include <signal.h>
#include <stdio.h>
@@ -54,10 +55,9 @@
#endif
#include "event.h"
+#include "event-internal.h"
#include "evsignal.h"
-extern struct event_list eventqueue;
-
extern volatile sig_atomic_t evsignal_caught;
struct pollop {
@@ -70,8 +70,8 @@ struct pollop {
void *poll_init (void);
int poll_add (void *, struct event *);
int poll_del (void *, struct event *);
-int poll_recalc (void *, int);
-int poll_dispatch (void *, struct timeval *);
+int poll_recalc (struct event_base *, void *, int);
+int poll_dispatch (struct event_base *, void *, struct timeval *);
struct eventop pollops = {
"poll",
@@ -102,7 +102,7 @@ poll_init(void)
*/
int
-poll_recalc(void *arg, int max)
+poll_recalc(struct event_base *base, void *arg, int max)
{
struct pollop *pop = arg;
@@ -110,7 +110,7 @@ poll_recalc(void *arg, int max)
}
int
-poll_dispatch(void *arg, struct timeval *tv)
+poll_dispatch(struct event_base *base, void *arg, struct timeval *tv)
{
int res, i, count, sec, nfds;
struct event *ev;
@@ -118,7 +118,7 @@ poll_dispatch(void *arg, struct timeval *tv)
count = pop->event_count;
nfds = 0;
- TAILQ_FOREACH(ev, &eventqueue, ev_next) {
+ TAILQ_FOREACH(ev, &base->eventqueue, ev_next) {
if (nfds + 1 >= count) {
if (count < 32)
count = 32;