diff options
author | Max Kellermann <max@duempel.org> | 2009-02-10 18:51:53 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-02-10 18:51:53 +0100 |
commit | facf146cfd557d04edeb7d06ca3230dbe86659a3 (patch) | |
tree | c01823b6c7862ed4d29a057f5bfbd86687becf2a /src | |
parent | 4493a9642522890f81ea505266c1a46f551c45e7 (diff) | |
download | mpd-facf146cfd557d04edeb7d06ca3230dbe86659a3.tar.gz mpd-facf146cfd557d04edeb7d06ca3230dbe86659a3.tar.xz mpd-facf146cfd557d04edeb7d06ca3230dbe86659a3.zip |
output_all: moved code to audio_output_all_finished()
audio_output_all_finished() returns bool, not int.
Diffstat (limited to '')
-rw-r--r-- | src/output_all.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/output_all.c b/src/output_all.c index 253bed8bc..166dbb430 100644 --- a/src/output_all.c +++ b/src/output_all.c @@ -127,23 +127,26 @@ audio_output_all_finish(void) notify_deinit(&audio_output_client_notify); } -static void audio_output_wait_all(void) -{ - unsigned i; - - while (1) { - int finished = 1; - for (i = 0; i < num_audio_outputs; ++i) - if (audio_output_is_open(&audio_outputs[i]) && - !audio_output_command_is_finished(&audio_outputs[i])) - finished = 0; +/** + * Determine if all (active) outputs have finished the current + * command. + */ +static bool +audio_output_all_finished(void) +{ + for (unsigned i = 0; i < num_audio_outputs; ++i) + if (audio_output_is_open(&audio_outputs[i]) && + !audio_output_command_is_finished(&audio_outputs[i])) + return false; - if (finished) - break; + return true; +} +static void audio_output_wait_all(void) +{ + while (!audio_output_all_finished()) notify_wait(&audio_output_client_notify); - }; } static void |