diff options
author | Max Kellermann <max@musicpd.org> | 2020-01-18 21:16:51 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2020-01-18 21:46:18 +0100 |
commit | 7732db0aeed32cf0c609dda9fd0b029478d7c0db (patch) | |
tree | b8beba587d97f212b93c126d8a3b8ef7751e48fd | |
parent | 37f984ba743d6b4e4c24110ccc8a50058f808cf5 (diff) |
output/Control: move code to method StopThread()
-rw-r--r-- | src/output/Control.cxx | 16 | ||||
-rw-r--r-- | 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<FilteredAudioOutput> _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. */ |