From 9e0f7dcd1a9c000a78cf283af4fa593e808ed374 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 26 Aug 2008 08:27:04 +0200 Subject: added dc_command_finished() dc_command_finished() is invoked by the decoder thread when it has finished a command (sent by the player thread). It resets dc.command and wakes up the player thread. This combination was used at a lot of places, and by introducing this function, the code will be more readable. --- src/decode.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/decode.c') diff --git a/src/decode.c b/src/decode.c index 551f40caa..dff876296 100644 --- a/src/decode.c +++ b/src/decode.c @@ -70,6 +70,14 @@ static void dc_command(enum decoder_command cmd) dc_command_wait(); } +void dc_command_finished(void) +{ + assert(dc.command != DECODE_COMMAND_NONE); + + dc.command = DECODE_COMMAND_NONE; + decoder_wakeup_player(); +} + static void stopDecode(void) { if (dc.command == DECODE_COMMAND_START || @@ -346,8 +354,7 @@ static void * decoder_task(mpd_unused void *arg) dc.command == DECODE_COMMAND_SEEK) { decodeStart(); } else if (dc.command == DECODE_COMMAND_STOP) { - dc.command = DECODE_COMMAND_NONE; - decoder_wakeup_player(); + dc_command_finished(); } else { decoder_sleep(); } -- cgit v1.2.3