aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2008-04-12 09:46:11 +0000
committerEric Wong <normalperson@yhbt.net>2008-04-12 09:46:11 +0000
commitbaf9b94ecf3872f35717c3236a0040160ec99aef (patch)
treeca6113fe6fb4199a9eb8b93134b376ae9786c1cd /src/main.c
parent804088f5901fcc20cc80fb1dba6960703fc3cdf7 (diff)
downloadmpd-baf9b94ecf3872f35717c3236a0040160ec99aef.tar.gz
mpd-baf9b94ecf3872f35717c3236a0040160ec99aef.tar.xz
mpd-baf9b94ecf3872f35717c3236a0040160ec99aef.zip
Fix the problem of songs not advancing without client activity
The select() in the main event loop blocks now (saving us many unnecessary wakeups). This interacted badly with the threads that were trying to wakeup the main task via pthread_cond_signal() since the main task was not blocked on a condition variable, but on select(). So now if we detect a need to wakeup the player, we write to a pipe which select() is watching instead of blindly calling pthread_cond_signal(). git-svn-id: https://svn.musicpd.org/mpd/trunk@7347 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/main.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/src/main.c b/src/main.c
index d3cc35924..1e77dc2fd 100644
--- a/src/main.c
+++ b/src/main.c
@@ -43,6 +43,7 @@
#include "utils.h"
#include "normalize.h"
#include "zeroconf.h"
+#include "main_notify.h"
#include "os_compat.h"
#define SYSTEM_CONFIG_FILE_LOCATION "/etc/mpd.conf"
@@ -56,8 +57,6 @@ typedef struct _Options {
int verbose;
} Options;
-static Notify main_notify;
-
/*
* from git-1.3.0, needed for solaris
*/
@@ -380,16 +379,6 @@ 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;
@@ -432,10 +421,9 @@ int main(int argc, char *argv[])
initNormalization();
initInputStream();
- notifyInit(&main_notify);
-
daemonize(&options);
+ init_main_notify();
setup_log_output(options.stdOutput);
initSigHandlers();
@@ -447,8 +435,6 @@ int main(int argc, char *argv[])
playerInit(&getPlayerData()->playerControl);
read_state_file();
- notifyEnter(&main_notify);
-
while (COMMAND_RETURN_KILL != doIOForInterfaces() &&
COMMAND_RETURN_KILL != handlePendingSignals()) {
syncPlayerAndPlaylist();