From 7732db0aeed32cf0c609dda9fd0b029478d7c0db Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 18 Jan 2020 21:16:51 +0100 Subject: [PATCH] output/Control: move code to method StopThread() --- src/output/Control.cxx | 16 ++++++++++++---- src/output/Control.hxx | 2 ++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/output/Control.cxx b/src/output/Control.cxx index efcef67e4..b4168514f 100644 --- a/src/output/Control.cxx +++ b/src/output/Control.cxx @@ -38,10 +38,7 @@ AudioOutputControl::AudioOutputControl(std::unique_ptr _out AudioOutputControl::~AudioOutputControl() noexcept { - BeginDestroy(); - - if (thread.IsDefined()) - thread.Join(); + StopThread(); } void @@ -383,3 +380,14 @@ AudioOutputControl::BeginDestroy() noexcept } } } + +void +AudioOutputControl::StopThread() noexcept +{ + BeginDestroy(); + + if (thread.IsDefined()) + thread.Join(); + + assert(IsCommandFinished()); +} diff --git a/src/output/Control.hxx b/src/output/Control.hxx index b1e33793f..26a1bb3dc 100644 --- a/src/output/Control.hxx +++ b/src/output/Control.hxx @@ -566,6 +566,8 @@ private: */ void InternalDrain() noexcept; + void StopThread() noexcept; + /** * The OutputThread. */