output/Thread: KILL implicitly closes and disables the AudioOutput

Reduce shutdown latency by two commands per output.
This commit is contained in:
Max Kellermann 2016-12-14 08:29:09 +01:00
parent b107a1583f
commit fb907f5f76
3 changed files with 4 additions and 10 deletions

View File

@ -43,14 +43,8 @@ MultipleOutputs::MultipleOutputs(MixerListener &_mixer_listener)
MultipleOutputs::~MultipleOutputs()
{
for (auto i : outputs) {
{
const ScopeLock lock(i->mutex);
i->DisableWait();
}
for (auto i : outputs)
i->Finish();
}
}
static AudioOutput *

View File

@ -276,9 +276,8 @@ AudioOutput::StopThread()
void
AudioOutput::Finish()
{
LockCloseWait();
assert(!fail_timer.IsDefined());
if (mixer != nullptr)
mixer_auto_close(mixer);
if (thread.IsDefined())
StopThread();

View File

@ -642,6 +642,7 @@ AudioOutput::Task()
continue;
case Command::KILL:
Disable();
pipe.Cancel();
CommandFinished();
return;