diff options
author | Max Kellermann <max@duempel.org> | 2008-04-12 04:14:38 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-04-12 04:14:38 +0000 |
commit | b7ac3fab465f883220790df8cad84d8bd96446bb (patch) | |
tree | c283785ec78fd9ea9b803f7400aa4fe060cd44e8 /src/player.c | |
parent | 701cf6884ceb8a5a4791211258ce5d298d38e22f (diff) | |
download | mpd-b7ac3fab465f883220790df8cad84d8bd96446bb.tar.gz mpd-b7ac3fab465f883220790df8cad84d8bd96446bb.tar.xz mpd-b7ac3fab465f883220790df8cad84d8bd96446bb.zip |
use the notify API in the player
git-svn-id: https://svn.musicpd.org/mpd/trunk@7282 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r-- | src/player.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/player.c b/src/player.c index f9aedcd20..a8bb2404d 100644 --- a/src/player.c +++ b/src/player.c @@ -33,9 +33,6 @@ #include "sig_handlers.h" #include "os_compat.h" -static pthread_cond_t player_wakeup = PTHREAD_COND_INITIALIZER; -static pthread_mutex_t player_wakeup_mutex = PTHREAD_MUTEX_INITIALIZER; - static pthread_cond_t main_wakeup = PTHREAD_COND_INITIALIZER; static pthread_mutex_t main_wakeup_mutex = PTHREAD_MUTEX_INITIALIZER; @@ -43,12 +40,14 @@ static void playerCloseAudio(void); void wakeup_player_nb(void) { - pthread_cond_signal(&player_wakeup); + PlayerControl *pc = &(getPlayerData()->playerControl); + notifySignal(&pc->notify); } static void wakeup_player(void) { - pthread_cond_signal(&player_wakeup); + PlayerControl *pc = &(getPlayerData()->playerControl); + notifySignal(&pc->notify); pthread_cond_wait(&main_wakeup, &main_wakeup_mutex); } @@ -59,13 +58,16 @@ void wakeup_main_task(void) void player_sleep(void) { - pthread_cond_wait(&player_wakeup, &player_wakeup_mutex); + PlayerControl *pc = &(getPlayerData()->playerControl); + notifyWait(&pc->notify); } static void * player_task(mpd_unused void *unused) { PlayerControl *pc = &(getPlayerData()->playerControl); + notifyEnter(&pc->notify); + while (1) { if (pc->play) { decode(); |