aboutsummaryrefslogtreecommitdiffstats
path: root/src/player.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-04-11 01:53:25 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-04-11 01:53:25 +0000
commit12ee01660739b19fa9b0c112e6a6b266a4e2d6a8 (patch)
treeca377875b1101607907243c3bf330ad80b7018cf /src/player.c
parent171a7752a8fab0e1c55be1469a331ef20a7b3755 (diff)
downloadmpd-12ee01660739b19fa9b0c112e6a6b266a4e2d6a8.tar.gz
mpd-12ee01660739b19fa9b0c112e6a6b266a4e2d6a8.tar.xz
mpd-12ee01660739b19fa9b0c112e6a6b266a4e2d6a8.zip
make "update" command background/non-blocking
git-svn-id: https://svn.musicpd.org/mpd/trunk@665 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/player.c')
-rw-r--r--src/player.c37
1 files changed, 16 insertions, 21 deletions
diff --git a/src/player.c b/src/player.c
index 4efe55679..63ee4f062 100644
--- a/src/player.c
+++ b/src/player.c
@@ -66,29 +66,24 @@ void resetPlayer() {
getPlayerData()->playerControl.decode_pid = 0;
}
-void player_sigHandler(int signal) {
- if(signal==SIGCHLD) {
- int status;
- int pid = wait3(&status,WNOHANG,NULL);
- if(player_pid==pid) {
- if(WIFSIGNALED(status) && WTERMSIG(status)!=SIGTERM) {
- ERROR("player process died from a "
- "non-TERM signal: %i\n",
- WTERMSIG(status));
- }
- resetPlayer();
+void player_sigChldHandler(int pid, int status) {
+ if(player_pid==pid) {
+ if(WIFSIGNALED(status) && WTERMSIG(status)!=SIGTERM) {
+ ERROR("player process died from a "
+ "non-TERM signal: %i\n",
+ WTERMSIG(status));
}
- else if(pid==getPlayerData()->playerControl.decode_pid &&
- player_pid<=0)
- {
- if(WIFSIGNALED(status) && WTERMSIG(status)!=SIGTERM) {
- ERROR("(caught by master parent) "
- "decode process died from a "
- "non-TERM signal: %i\n",
- WTERMSIG(status));
- }
- getPlayerData()->playerControl.decode_pid = 0;
+ resetPlayer();
+ }
+ else if(pid==getPlayerData()->playerControl.decode_pid && player_pid<=0)
+ {
+ if(WIFSIGNALED(status) && WTERMSIG(status)!=SIGTERM) {
+ ERROR("(caught by master parent) "
+ "decode process died from a "
+ "non-TERM signal: %i\n",
+ WTERMSIG(status));
}
+ getPlayerData()->playerControl.decode_pid = 0;
}
}