provide more base-based functions :-)

svn:r125
This commit is contained in:
Niels Provos 2004-12-01 20:04:54 +00:00
parent f5a62ed30e
commit 256460459e
3 changed files with 21 additions and 7 deletions

20
event.c
View File

@ -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;

View File

@ -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 */

View 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));