From 25a806a347ce420126eb75d82c5fb875eb0a5e0d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 31 Oct 2009 17:02:12 +0100 Subject: 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. --- src/decoder_thread.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'src/decoder_thread.c') diff --git a/src/decoder_thread.c b/src/decoder_thread.c index 846b12353..712e4d20c 100644 --- a/src/decoder_thread.c +++ b/src/decoder_thread.c @@ -112,9 +112,7 @@ static void decoder_run_song(const struct song *song, const char *uri) dc.state = DECODE_STATE_START; dc.command = DECODE_COMMAND_NONE; - decoder_unlock(); - notify_signal(&pc.notify); - decoder_lock(); + player_signal(); /* wait for the input stream to become ready; its metadata will be available then */ @@ -294,17 +292,13 @@ static gpointer decoder_task(G_GNUC_UNUSED gpointer arg) dc.command = DECODE_COMMAND_NONE; - decoder_unlock(); - notify_signal(&pc.notify); - decoder_lock(); + player_signal(); break; case DECODE_COMMAND_STOP: dc.command = DECODE_COMMAND_NONE; - decoder_unlock(); - notify_signal(&pc.notify); - decoder_lock(); + player_signal(); break; case DECODE_COMMAND_NONE: -- cgit v1.2.3