diff --git a/src/output/Internal.hxx b/src/output/Internal.hxx index 6f45a44e7..bb8511f10 100644 --- a/src/output/Internal.hxx +++ b/src/output/Internal.hxx @@ -323,34 +323,34 @@ public: void LockCommandWait(Command cmd); /** - * Enables the device. + * Enables the device, but don't wait for completion. * * Caller must lock the mutex. */ - void EnableWait(); + void EnableAsync(); /** - * Disables the device. + * Disables the device, but don't wait for completion. * * Caller must lock the mutex. */ - void DisableWait(); + void DisableAsync(); /** * Attempt to enable or disable the device as specified by the * #enabled attribute; attempt to sync it with #really_enabled - * (wrapper for EnableWait() or DisableWait()). + * (wrapper for EnableAsync() or DisableAsync()). * * Caller must lock the mutex. */ - void EnableDisableWait() { + void EnableDisableAsync() { if (enabled == really_enabled) return; if (enabled) - EnableWait(); + EnableAsync(); else - DisableWait(); + DisableAsync(); } void LockPauseAsync(); diff --git a/src/output/MultipleOutputs.cxx b/src/output/MultipleOutputs.cxx index 6f846faaa..639aa1560 100644 --- a/src/output/MultipleOutputs.cxx +++ b/src/output/MultipleOutputs.cxx @@ -107,9 +107,16 @@ MultipleOutputs::FindByName(const char *name) const void MultipleOutputs::EnableDisable() { + /* parallel execution */ + for (auto ao : outputs) { const ScopeLock lock(ao->mutex); - ao->EnableDisableWait(); + ao->EnableDisableAsync(); + } + + for (auto ao : outputs) { + const ScopeLock lock(ao->mutex); + ao->WaitForCommand(); } } diff --git a/src/output/OutputControl.cxx b/src/output/OutputControl.cxx index 01bca7ae8..f2c635fba 100644 --- a/src/output/OutputControl.cxx +++ b/src/output/OutputControl.cxx @@ -70,7 +70,7 @@ AudioOutput::LockCommandWait(Command cmd) } void -AudioOutput::EnableWait() +AudioOutput::EnableAsync() { if (!thread.IsDefined()) { if (plugin.enable == nullptr) { @@ -84,11 +84,11 @@ AudioOutput::EnableWait() StartThread(); } - CommandWait(Command::ENABLE); + CommandAsync(Command::ENABLE); } void -AudioOutput::DisableWait() +AudioOutput::DisableAsync() { if (!thread.IsDefined()) { if (plugin.disable == nullptr) @@ -101,7 +101,7 @@ AudioOutput::DisableWait() return; } - CommandWait(Command::DISABLE); + CommandAsync(Command::DISABLE); } inline bool