From 408d52fe3995a34fe1559074fdabedd7589d512c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 2 Nov 2009 20:20:13 +0100 Subject: [PATCH] player_thread: check command before waiting during pause While paused, the player thread re-locks its mutex and waits for a signal. This is racy: when the command is set while the thread is waiting for the lock, it may wait forever. This patch adds another command check before player_wait(). --- src/player_thread.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/player_thread.c b/src/player_thread.c index 8f8466fc8..32d35f309 100644 --- a/src/player_thread.c +++ b/src/player_thread.c @@ -819,7 +819,9 @@ static void do_play(struct decoder_control *dc) if (player.paused) { player_lock(); - player_wait(); + + if (pc.command == PLAYER_COMMAND_NONE) + player_wait(); continue; } else if (music_pipe_size(player.pipe) > 0) { /* at least one music chunk is ready - send it