make "update" command background/non-blocking

git-svn-id: https://svn.musicpd.org/mpd/trunk@665 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
Warren Dukes
2004-04-11 01:53:25 +00:00
parent 171a7752a8
commit 12ee016607
7 changed files with 111 additions and 26 deletions

View File

@@ -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;
}
}