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() MultipleOutputs::~MultipleOutputs()
{ {
for (auto i : outputs) { for (auto i : outputs)
{
const ScopeLock lock(i->mutex);
i->DisableWait();
}
i->Finish(); i->Finish();
}
} }
static AudioOutput * static AudioOutput *

View File

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

View File

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