From 8a351e5bf8f97d3fddc564114eccbe473574facf Mon Sep 17 00:00:00 2001 From: Julien BLACHE Date: Tue, 7 Apr 2009 17:37:12 +0200 Subject: [PATCH] Manage explicit event bases --- src/daapd.h | 3 +++ src/main.c | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/daapd.h b/src/daapd.h index 5c4e8314..3e41b72c 100644 --- a/src/daapd.h +++ b/src/daapd.h @@ -79,4 +79,7 @@ typedef struct tag_config { extern CONFIG config; +/* Event bases */ +extern struct event_base *evbase_main; + #endif /* _DAAPD_H_ */ diff --git a/src/main.c b/src/main.c index 0884832a..a074e2e4 100644 --- a/src/main.c +++ b/src/main.c @@ -111,6 +111,8 @@ */ CONFIG config; /**< Main configuration structure, as read from configfile */ +struct event_base *evbase_main; + /* * Forwards */ @@ -550,7 +552,7 @@ int main(int argc, char *argv[]) { } /* Initialize libevent (after forking) */ - event_init(); + evbase_main = event_init(); main_timer = (struct event *)malloc(sizeof(struct event)); if (!main_timer) { @@ -698,12 +700,13 @@ int main(int argc, char *argv[]) { /* Set up main timer */ evtimer_set(main_timer, mainloop_cb, main_timer); + event_base_set(evbase_main, main_timer); evutil_timerclear(&tv); tv.tv_sec = MAIN_SLEEP_INTERVAL; evtimer_add(main_timer, &tv); /* Run the loop */ - event_dispatch(); + event_base_dispatch(evbase_main); DPRINTF(E_LOG,L_MAIN,"Stopping gracefully\n");