summaryrefslogtreecommitdiff
path: root/event.c
diff options
context:
space:
mode:
authorroot <root>2007-11-04 15:58:49 +0000
committerroot <root>2007-11-04 15:58:49 +0000
commit5e20ccfe261679c78f9aa365ac087fb0700e0f2b (patch)
tree1a45e376caae037cc6a6bedbf0f7d95fde17701d /event.c
parentbaf84e3741d88472c270efb118be8e3621ebe2d8 (diff)
better destroy support, separate into default loop and additional loops
Diffstat (limited to 'event.c')
-rw-r--r--event.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/event.c b/event.c
index 75cd06b..6e26a48 100644
--- a/event.c
+++ b/event.c
@@ -32,6 +32,7 @@
#include <stddef.h>
#include <stdlib.h>
#include <sys/time.h>
+#include <assert.h>
#include "event.h"
@@ -49,7 +50,7 @@ struct event_base
int dummy;
};
-static struct event_base x_base, *x_cur;
+static struct event_base *x_cur;
static void
tv_set (struct timeval *tv, ev_tstamp at)
@@ -82,9 +83,14 @@ const char *event_get_method (void)
void *event_init (void)
{
#if EV_MULTIPLICITY
- x_cur = (struct event_base *)ev_loop_new (EVMETHOD_AUTO);
+ if (x_cur)
+ x_cur = (struct event_base *)ev_loop_new (EVMETHOD_AUTO);
+ else
+ x_cur = ev_default_loop (EVMETHOD_AUTO);
#else
- x_cur = &x_base;
+ assert (("multiple event bases not supported when not compiled with EV_MULTIPLICITY", !x_cur));
+
+ x_cur = (struct event_base *)ev_default_loop (EVMETHOD_AUTO);
#endif
return x_cur;