From e83f805b8fa34db8ac0b885d3fb78c0e6437c908 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 10 Jan 2013 19:13:00 +0100 Subject: Main, IOThread: move GMainLoop setup code to class EventLoop --- src/Main.cxx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/Main.cxx') diff --git a/src/Main.cxx b/src/Main.cxx index 1c58e0e40..f9062cccb 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -45,6 +45,7 @@ #include "Log.hxx" #include "GlobalEvents.hxx" #include "InputInit.hxx" +#include "event/Loop.hxx" #include "IOThread.hxx" extern "C" { @@ -96,7 +97,7 @@ enum { }; GThread *main_task; -GMainLoop *main_loop; +EventLoop *main_loop; Partition *global_partition; @@ -332,7 +333,7 @@ idle_event_emitted(void) static void shutdown_event_emitted(void) { - g_main_loop_quit(main_loop); + main_loop->Break(); } int main(int argc, char *argv[]) @@ -401,7 +402,7 @@ int mpd_main(int argc, char *argv[]) daemonize_set_user(); main_task = g_thread_self(); - main_loop = g_main_loop_new(NULL, FALSE); + main_loop = new EventLoop(EventLoop::Default()); GlobalEvents::Initialize(); GlobalEvents::Register(GlobalEvents::IDLE, idle_event_emitted); @@ -504,7 +505,7 @@ int mpd_main(int argc, char *argv[]) #endif /* run the main loop */ - g_main_loop_run(main_loop); + main_loop->Run(); #ifdef WIN32 win32_app_stopping(); @@ -512,7 +513,7 @@ int mpd_main(int argc, char *argv[]) /* cleanup */ - g_main_loop_unref(main_loop); + delete main_loop; #ifdef ENABLE_INOTIFY mpd_inotify_finish(); -- cgit v1.2.3