{decoder,player}_control: removed duplicate wakeups
Don't wake up the target thread in every iteration of the wait() loop. Waking it up once, right after the command has been set, must be enough.
This commit is contained in:
parent
93d8f9f00e
commit
64a481d873
@ -44,10 +44,8 @@ dc_deinit(struct decoder_control *dc)
|
||||
static void
|
||||
dc_command_wait_locked(struct decoder_control *dc)
|
||||
{
|
||||
while (dc->command != DECODE_COMMAND_NONE) {
|
||||
decoder_signal(dc);
|
||||
while (dc->command != DECODE_COMMAND_NONE)
|
||||
player_wait_decoder(dc);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -62,6 +60,7 @@ static void
|
||||
dc_command_locked(struct decoder_control *dc, enum decoder_command cmd)
|
||||
{
|
||||
dc->command = cmd;
|
||||
decoder_signal(dc);
|
||||
dc_command_wait_locked(dc);
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,6 @@ struct notify audio_output_client_notify;
|
||||
static void ao_command_wait(struct audio_output *ao)
|
||||
{
|
||||
while (ao->command != AO_COMMAND_NONE) {
|
||||
g_cond_signal(ao->cond);
|
||||
g_mutex_unlock(ao->mutex);
|
||||
notify_wait(&audio_output_client_notify);
|
||||
g_mutex_lock(ao->mutex);
|
||||
@ -51,6 +50,7 @@ static void ao_command(struct audio_output *ao, enum audio_output_command cmd)
|
||||
{
|
||||
assert(ao->command == AO_COMMAND_NONE);
|
||||
ao->command = cmd;
|
||||
g_cond_signal(ao->cond);
|
||||
ao_command_wait(ao);
|
||||
}
|
||||
|
||||
|
@ -72,10 +72,8 @@ pc_song_deleted(const struct song *song)
|
||||
static void
|
||||
player_command_wait_locked(void)
|
||||
{
|
||||
while (pc.command != PLAYER_COMMAND_NONE) {
|
||||
player_signal();
|
||||
while (pc.command != PLAYER_COMMAND_NONE)
|
||||
g_cond_wait(main_cond, pc.mutex);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@ -84,6 +82,7 @@ player_command_locked(enum player_command cmd)
|
||||
assert(pc.command == PLAYER_COMMAND_NONE);
|
||||
|
||||
pc.command = cmd;
|
||||
player_signal();
|
||||
player_command_wait_locked();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user