]> granicus.if.org Git - libevent/commitdiff
provide more base-based functions :-)
authorNiels Provos <provos@gmail.com>
Wed, 1 Dec 2004 20:04:54 +0000 (20:04 +0000)
committerNiels Provos <provos@gmail.com>
Wed, 1 Dec 2004 20:04:54 +0000 (20:04 +0000)
svn:r125

event.c
event.h
test/regress.c

diff --git a/event.c b/event.c
index cc5b1640ef9f606ddb63adbe14131d9e30d658bb..f1b8b3618547e67161f77373f441ccee9f920552 100644 (file)
--- a/event.c
+++ b/event.c
@@ -181,13 +181,19 @@ event_init(void)
                    current_base->evsel->name); 
 
        /* allocate a single active event queue */
-       event_priority_init(current_base, 1);
+       event_base_priority_init(current_base, 1);
 
        return (current_base);
 }
 
 int
-event_priority_init(struct event_base *base, int npriorities)
+event_priority_init(int npriorities)
+{
+  return event_base_priority_init(current_base, npriorities);
+}
+
+int
+event_base_priority_init(struct event_base *base, int npriorities)
 {
        int i;
 
@@ -272,6 +278,12 @@ event_dispatch(void)
        return (event_loop(0));
 }
 
+int
+event_base_dispatch(struct event_base *event_base)
+{
+  return (event_base_loop(event_base, 0));
+}
+
 static void
 event_loopexit_cb(int fd, short what, void *arg)
 {
@@ -293,11 +305,11 @@ event_loopexit(struct timeval *tv)
 int
 event_loop(int flags)
 {
-       return event_loop_base(current_base, flags);
+       return event_base_loop(current_base, flags);
 }
 
 int
-event_loop_base(struct event_base *base, int flags)
+event_base_loop(struct event_base *base, int flags)
 {
        const struct eventop *evsel = base->evsel;
        void *evbase = base->evbase;
diff --git a/event.h b/event.h
index bb4019de39f3affbb005d7715ec62cc0fe2ff981..05b56fe72442e1cefe4f4bd4ae34cd94167e8932 100644 (file)
--- a/event.h
+++ b/event.h
@@ -127,11 +127,12 @@ struct eventop {
 
 void *event_init(void);
 int event_dispatch(void);
+int event_base_dispatch(struct event_base *);
 
 #define EVLOOP_ONCE    0x01
 #define EVLOOP_NONBLOCK        0x02
 int event_loop(int);
-int event_loop_base(struct event_base *, int);
+int event_base_loop(struct event_base *, int);
 int event_loopexit(struct timeval *);  /* Causes the loop to exit */
 
 #define evtimer_add(ev, tv)            event_add(ev, tv)
@@ -170,7 +171,8 @@ int event_pending(struct event *, short, struct timeval *);
 
 /* These functions deal with event priorities */
 
-int    event_priority_init(struct event_base *, int);
+int    event_priority_init(int);
+int    event_base_priority_init(struct event_base *, int);
 int    event_priority_set(struct event *, int);
 
 /* These functions deal with buffering input and output */
index f12b9231e6f47ef98e8bf73d9b5d745adb13ae6c..7d3b1eb21129cc28d98daf6b9ceb87d6d0f4a435 100644 (file)
@@ -562,7 +562,7 @@ test_priorities(int npriorities)
        snprintf(buf, sizeof(buf), "Priorities %d: ", npriorities);
        setup_test(buf);
 
-       event_priority_init(event_base, npriorities);
+       event_base_priority_init(event_base, npriorities);
 
        memset(&one, 0, sizeof(one));
        memset(&two, 0, sizeof(two));