diff options
author | Max Kellermann <max@duempel.org> | 2008-08-26 08:27:16 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-08-26 08:27:16 +0200 |
commit | ae0033028595b96352c1c769eaeeeaa0c12bccb9 (patch) | |
tree | 1f7565ae1b10d8e199724c4e57a3d0717fc1f657 /src/player_thread.c | |
parent | 92d9797b8cb5b51cdb1cb7f40b12a87ad91eac2e (diff) | |
download | mpd-ae0033028595b96352c1c769eaeeeaa0c12bccb9.tar.gz mpd-ae0033028595b96352c1c769eaeeeaa0c12bccb9.tar.xz mpd-ae0033028595b96352c1c769eaeeeaa0c12bccb9.zip |
rewrote playerKill()
playerKill() was marked as deprecated, but it seems like a good idea
to do proper cleanup in all threads (e.g. for usable valgrind
results). Introduce the command "EXIT" which makes the player thread
exit cleanly.
Diffstat (limited to '')
-rw-r--r-- | src/player_thread.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/player_thread.c b/src/player_thread.c index 3784445e9..2abb367db 100644 --- a/src/player_thread.c +++ b/src/player_thread.c @@ -127,6 +127,7 @@ static void processDecodeInput(int *pause_r, unsigned int *bbp_r, case PLAYER_COMMAND_NONE: case PLAYER_COMMAND_PLAY: case PLAYER_COMMAND_STOP: + case PLAYER_COMMAND_EXIT: case PLAYER_COMMAND_CLOSE_AUDIO: break; @@ -225,6 +226,7 @@ static void decodeParent(void) processDecodeInput(&do_pause, &bbp, &do_xfade, &decodeWaitedOn, &next); if (pc.command == PLAYER_COMMAND_STOP || + pc.command == PLAYER_COMMAND_EXIT || pc.command == PLAYER_COMMAND_CLOSE_AUDIO) { dropBufferedAudio(); break; @@ -442,6 +444,12 @@ static void * player_task(mpd_unused void *arg) player_command_finished(); break; + case PLAYER_COMMAND_EXIT: + closeAudioDevice(); + player_command_finished(); + pthread_exit(NULL); + break; + case PLAYER_COMMAND_LOCK_QUEUE: pc.queueLockState = PLAYER_QUEUE_LOCKED; player_command_finished(); |