fix: Acquire lock when stopping modules

This commit is contained in:
Michael Carlberg 2016-10-18 10:35:04 +02:00
parent 5796bde25d
commit df93cabf22
3 changed files with 10 additions and 28 deletions

View File

@ -210,13 +210,16 @@ namespace modules {
}
void stop() {
if (!enabled())
return;
m_log.trace("%s: Stop", name());
enable(false);
wakeup();
if (!on_stop.empty())
on_stop.emit(name());
std::lock_guard<threading_util::spin_lock> lck(this->update_lock);
{
if (!enabled())
return;
m_log.trace("%s: Stop", name());
enable(false);
wakeup();
if (!on_stop.empty())
on_stop.emit(name());
}
}
void refresh() {

View File

@ -17,14 +17,6 @@ namespace modules {
public:
using timer_module::timer_module;
~network_module() {
std::lock_guard<threading_util::spin_lock> lck(this->update_lock);
{
m_wireless.reset();
m_wired.reset();
}
}
void setup() {
// Load configuration values
REQ_CONFIG_VALUE(name(), m_interface, "interface");

View File

@ -108,19 +108,6 @@ namespace modules {
// }}}
}
void stop() {
// Deconstruct all mixers before putting the module in its stopped state {{{
std::lock_guard<threading_util::spin_lock> lck(this->update_lock);
m_mixers[mixer::MASTER].reset();
m_mixers[mixer::SPEAKER].reset();
m_mixers[mixer::HEADPHONE].reset();
m_controls[control::HEADPHONE].reset();
event_module::stop();
// }}}
}
bool has_event() {
// Poll for mixer and control events {{{