diff options
author | Max Kellermann <max@duempel.org> | 2009-10-31 17:02:12 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-10-31 17:02:12 +0100 |
commit | 25a806a347ce420126eb75d82c5fb875eb0a5e0d (patch) | |
tree | 0d39bed8c073a720acd42f17b04dbee91b0a8c01 /src/output | |
parent | 73cff374fd94a1c16e0201fcda020396c0f41962 (diff) | |
download | mpd-25a806a347ce420126eb75d82c5fb875eb0a5e0d.tar.gz mpd-25a806a347ce420126eb75d82c5fb875eb0a5e0d.tar.xz mpd-25a806a347ce420126eb75d82c5fb875eb0a5e0d.zip |
player_control: protect command, state, error with a mutex
Use GMutex/GCond instead of the notify library. Manually lock the
player_control object before accessing the protected attributes. Use
the GCond object to notify the player thread and the main thread.
Diffstat (limited to '')
-rw-r--r-- | src/output_all.c | 9 | ||||
-rw-r--r-- | src/output_thread.c | 2 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/output_all.c b/src/output_all.c index 08f4ee0dc..bdf0385bb 100644 --- a/src/output_all.c +++ b/src/output_all.c @@ -445,10 +445,15 @@ audio_output_all_check(void) bool audio_output_all_wait(unsigned threshold) { - if (audio_output_all_check() < threshold) + player_lock(); + + if (audio_output_all_check() < threshold) { + player_unlock(); return true; + } - notify_wait(&pc.notify); + player_wait(); + player_unlock(); return audio_output_all_check() < threshold; } diff --git a/src/output_thread.c b/src/output_thread.c index 24a22f6df..ef8fe7418 100644 --- a/src/output_thread.c +++ b/src/output_thread.c @@ -359,7 +359,7 @@ ao_play(struct audio_output *ao) ao->chunk_finished = true; g_mutex_unlock(ao->mutex); - notify_signal(&pc.notify); + player_lock_signal(); g_mutex_lock(ao->mutex); return true; |