#include <stddef.h>
#include <stdlib.h>
#include <sys/time.h>
+#include <assert.h>
-#include "event.h"
+#ifndef EV_EMBED
+# include "event.h"
+#endif
#if EV_MULTIPLICITY
# define dLOOPev struct ev_loop *loop = (struct ev_loop *)ev->ev_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)
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;
return event_base_dispatch (x_cur);
}
-#ifdef EV_STANDALONE
+#ifdef EV_EMBED
void event_set_log_callback (event_log_cb cb)
{
/* nop */