aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-01-01 18:22:11 +0100
committerMax Kellermann <max@duempel.org>2009-01-01 18:22:11 +0100
commitb3e2635ac1d6cb46ae5a41e4c9760127453e49db (patch)
treeb3fe2592a7f40eea7c28a2f7a9f6e8b386d61b55 /src/main.c
parent22bb5a5856ff4c195a179610dfb3f09af3183467 (diff)
downloadmpd-b3e2635ac1d6cb46ae5a41e4c9760127453e49db.tar.gz
mpd-b3e2635ac1d6cb46ae5a41e4c9760127453e49db.tar.xz
mpd-b3e2635ac1d6cb46ae5a41e4c9760127453e49db.zip
event_pipe: added pipe_event enum and callbacks
Make the event_pipe (formerly main_notify) send/receive a set of events, with a callback for each one. The default event PIPE_EVENT_SIGNAL does not have a callback. It is still there for waking up the main thread, when it is waiting for the player thread.
Diffstat (limited to '')
-rw-r--r--src/main.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/main.c b/src/main.c
index f7ab7f1ee..aec3e92e9 100644
--- a/src/main.c
+++ b/src/main.c
@@ -190,17 +190,15 @@ timer_save_state_file(G_GNUC_UNUSED gpointer data)
return true;
}
-void
-main_notify_triggered(void)
+/**
+ * event_pipe callback function for PIPE_EVENT_IDLE
+ */
+static void
+idle_event_emitted(void)
{
- unsigned flags;
-
- syncPlayerAndPlaylist();
- reap_update_task();
-
/* send "idle" notificaions to all subscribed
clients */
- flags = idle_get();
+ unsigned flags = idle_get();
if (flags != 0)
client_manager_idle_add(flags);
}
@@ -243,6 +241,10 @@ int main(int argc, char *argv[])
main_loop = g_main_loop_new(NULL, FALSE);
+ event_pipe_init();
+ event_pipe_register(PIPE_EVENT_IDLE, idle_event_emitted);
+ event_pipe_register(PIPE_EVENT_PLAYLIST, syncPlayerAndPlaylist);
+
path_global_init();
mapper_init();
initPermissions();
@@ -253,8 +255,6 @@ int main(int argc, char *argv[])
decoder_plugin_init_all();
update_global_init();
- event_pipe_init();
-
openDB(&options, argv[0]);
command_init();