output/MultipleOutputs: parallelize EnableDisable()
This commit is contained in:
parent
6425b4f9f5
commit
7e1b53480e
@ -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();
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user