send SIGCONT to the player process whenever we need to busy wait on it

This fixes the problem of playlist moving/changnig while we're paused

Followup to r6822

git-svn-id: https://svn.musicpd.org/mpd/trunk@6859 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
Eric Wong 2007-09-06 00:19:33 +00:00
parent b2ae8da509
commit fe584bb11c

View File

@ -194,6 +194,10 @@ int playerWait(int fd)
if (pc->wait) if (pc->wait)
return 0; return 0;
pid = player_pid;
if (pid > 0)
kill(pid, SIGCONT);
if (playerStop(fd) < 0) if (playerStop(fd) < 0)
return -1; return -1;
@ -231,6 +235,8 @@ int playerPlay(int fd, Song * song)
} }
resetPlayerMetadata(); resetPlayerMetadata();
if (player_pid)
kill(player_pid, SIGCONT);
while (player_pid > 0 && pc->play) while (player_pid > 0 && pc->play)
my_usleep(1000); my_usleep(1000);
@ -380,6 +386,7 @@ void playerCloseAudio(void)
if (playerStop(STDERR_FILENO) < 0) if (playerStop(STDERR_FILENO) < 0)
return; return;
pc->closeAudio = 1; pc->closeAudio = 1;
kill(player_pid, SIGCONT);
while (player_pid > 0 && pc->closeAudio) while (player_pid > 0 && pc->closeAudio)
my_usleep(1000); my_usleep(1000);
} }
@ -425,6 +432,7 @@ void playerQueueLock(void)
PlayerControl *pc = &(getPlayerData()->playerControl); PlayerControl *pc = &(getPlayerData()->playerControl);
if (player_pid > 0 && pc->queueLockState == PLAYER_QUEUE_UNLOCKED) { if (player_pid > 0 && pc->queueLockState == PLAYER_QUEUE_UNLOCKED) {
kill(player_pid, SIGCONT);
pc->lockQueue = 1; pc->lockQueue = 1;
while (player_pid > 0 && pc->lockQueue) while (player_pid > 0 && pc->lockQueue)
my_usleep(1000); my_usleep(1000);
@ -436,6 +444,7 @@ void playerQueueUnlock(void)
PlayerControl *pc = &(getPlayerData()->playerControl); PlayerControl *pc = &(getPlayerData()->playerControl);
if (player_pid > 0 && pc->queueLockState == PLAYER_QUEUE_LOCKED) { if (player_pid > 0 && pc->queueLockState == PLAYER_QUEUE_LOCKED) {
kill(player_pid, SIGCONT);
pc->unlockQueue = 1; pc->unlockQueue = 1;
while (player_pid > 0 && pc->unlockQueue) while (player_pid > 0 && pc->unlockQueue)
my_usleep(1000); my_usleep(1000);
@ -467,6 +476,8 @@ int playerSeek(int fd, Song * song, float time)
resetPlayerMetadata(); resetPlayerMetadata();
pc->seekWhere = time; pc->seekWhere = time;
pc->seek = 1; pc->seek = 1;
if (player_pid)
kill(player_pid, SIGCONT);
while (player_pid > 0 && pc->seek) while (player_pid > 0 && pc->seek)
my_usleep(1000); my_usleep(1000);
} }