output/alsa: move code to LockCaughtError()

This commit is contained in:
Max Kellermann 2017-11-14 21:07:59 +01:00
parent febd1ad09c
commit e0f777d4eb

View File

@ -300,6 +300,12 @@ private:
return !!error; return !!error;
} }
void LockCaughtError() noexcept {
const std::lock_guard<Mutex> lock(mutex);
error = std::current_exception();
cond.signal();
}
/* virtual methods from class MultiSocketMonitor */ /* virtual methods from class MultiSocketMonitor */
std::chrono::steady_clock::duration PrepareSockets() noexcept override; std::chrono::steady_clock::duration PrepareSockets() noexcept override;
void DispatchSockets() noexcept override; void DispatchSockets() noexcept override;
@ -865,10 +871,7 @@ try {
} }
} catch (const std::runtime_error &) { } catch (const std::runtime_error &) {
MultiSocketMonitor::Reset(); MultiSocketMonitor::Reset();
LockCaughtError();
const std::lock_guard<Mutex> lock(mutex);
error = std::current_exception();
cond.signal();
} }
const struct AudioOutputPlugin alsa_output_plugin = { const struct AudioOutputPlugin alsa_output_plugin = {