diff options
author | Max Kellermann <max@musicpd.org> | 2018-01-02 17:12:00 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-01-02 18:03:48 +0100 |
commit | b0199245d5ec1868c5d8069d825b87fb66d22cff (patch) | |
tree | e27cd502d0b9a3ae255747d3c24591fc02a50ea5 /src/output | |
parent | b93e3b2cf6f7e0ae9909f9fab4587e2fde5829c1 (diff) |
output/Thread: move code to method InternalDrain()
Diffstat (limited to 'src/output')
-rw-r--r-- | src/output/Control.hxx | 7 | ||||
-rw-r--r-- | src/output/Thread.cxx | 14 |
2 files changed, 17 insertions, 4 deletions
diff --git a/src/output/Control.hxx b/src/output/Control.hxx index 51e9f5d4e..bbee45c95 100644 --- a/src/output/Control.hxx +++ b/src/output/Control.hxx @@ -520,6 +520,13 @@ private: void InternalPause() noexcept; /** + * Runs inside the OutputThread. + * Caller must lock the mutex. + * Handles exceptions. + */ + void InternalDrain() noexcept; + + /** * The OutputThread. */ void Task(); diff --git a/src/output/Thread.cxx b/src/output/Thread.cxx index 2a355eb11..ac382864a 100644 --- a/src/output/Thread.cxx +++ b/src/output/Thread.cxx @@ -362,6 +362,14 @@ AudioOutputControl::InternalPause() noexcept skip_delay = true; } +inline void +AudioOutputControl::InternalDrain() noexcept +{ + const ScopeUnlock unlock(mutex); + + output->Drain(); +} + void AudioOutputControl::Task() { @@ -421,10 +429,8 @@ AudioOutputControl::Task() continue; case Command::DRAIN: - if (open) { - const ScopeUnlock unlock(mutex); - output->Drain(); - } + if (open) + InternalDrain(); CommandFinished(); continue; |