aboutsummaryrefslogtreecommitdiff
path: root/src/Main.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-01-10 19:13:00 +0100
committerMax Kellermann <max@duempel.org>2013-01-14 09:15:49 +0100
commite83f805b8fa34db8ac0b885d3fb78c0e6437c908 (patch)
tree25c78bb3b016875aa9df2ec5449c623148083531 /src/Main.cxx
parentbe98afe34d550a322adea78f92f1fd2088408e96 (diff)
Main, IOThread: move GMainLoop setup code to class EventLoop
Diffstat (limited to 'src/Main.cxx')
-rw-r--r--src/Main.cxx11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/Main.cxx b/src/Main.cxx
index 1c58e0e4..f9062ccc 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();