aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-04-12 04:14:45 +0000
committerEric Wong <normalperson@yhbt.net>2008-04-12 04:14:45 +0000
commit4ee8396f417d15c161b425c6f8c15fe845242434 (patch)
treef284695c784364904aebe52d0129e3a98deb4384 /src/main.c
parentb7ac3fab465f883220790df8cad84d8bd96446bb (diff)
downloadmpd-4ee8396f417d15c161b425c6f8c15fe845242434.tar.gz
mpd-4ee8396f417d15c161b425c6f8c15fe845242434.tar.xz
mpd-4ee8396f417d15c161b425c6f8c15fe845242434.zip
use the notify API in the main thread
git-svn-id: https://svn.musicpd.org/mpd/trunk@7283 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 428ef2a91..1c513b171 100644
--- a/src/main.c
+++ b/src/main.c
@@ -56,6 +56,8 @@ typedef struct _Options {
int verbose;
} Options;
+static Notify main_notify;
+
/*
* from git-1.3.0, needed for solaris
*/
@@ -378,6 +380,16 @@ static void killFromPidFile(char *cmd, int killOption)
exit(EXIT_SUCCESS);
}
+void wakeup_main_task(void)
+{
+ notifySignal(&main_notify);
+}
+
+void wait_main_task(void)
+{
+ notifySignal(&main_notify);
+}
+
int main(int argc, char *argv[])
{
Options options;
@@ -420,6 +432,8 @@ int main(int argc, char *argv[])
initNormalization();
initInputStream();
+ notifyInit(&main_notify);
+
daemonize(&options);
setup_log_output(options.stdOutput);
@@ -433,6 +447,8 @@ int main(int argc, char *argv[])
playerInit();
read_state_file();
+ notifyEnter(&main_notify);
+
while (COMMAND_RETURN_KILL != doIOForInterfaces() &&
COMMAND_RETURN_KILL != handlePendingSignals()) {
syncPlayerAndPlaylist();