From e0f777d4eb2ae6a96f8182db3652c8a913f5a957 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 14 Nov 2017 21:07:59 +0100 Subject: [PATCH] output/alsa: move code to LockCaughtError() --- src/output/plugins/AlsaOutputPlugin.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/output/plugins/AlsaOutputPlugin.cxx b/src/output/plugins/AlsaOutputPlugin.cxx index 347539ccd..c7dda9e9a 100644 --- a/src/output/plugins/AlsaOutputPlugin.cxx +++ b/src/output/plugins/AlsaOutputPlugin.cxx @@ -300,6 +300,12 @@ private: return !!error; } + void LockCaughtError() noexcept { + const std::lock_guard lock(mutex); + error = std::current_exception(); + cond.signal(); + } + /* virtual methods from class MultiSocketMonitor */ std::chrono::steady_clock::duration PrepareSockets() noexcept override; void DispatchSockets() noexcept override; @@ -865,10 +871,7 @@ try { } } catch (const std::runtime_error &) { MultiSocketMonitor::Reset(); - - const std::lock_guard lock(mutex); - error = std::current_exception(); - cond.signal(); + LockCaughtError(); } const struct AudioOutputPlugin alsa_output_plugin = {