From 12ee01660739b19fa9b0c112e6a6b266a4e2d6a8 Mon Sep 17 00:00:00 2001 From: Warren Dukes Date: Sun, 11 Apr 2004 01:53:25 +0000 Subject: make "update" command background/non-blocking git-svn-id: https://svn.musicpd.org/mpd/trunk@665 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/player.c | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) (limited to 'src/player.c') 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; } } -- cgit v1.2.3