fix: Acquire lock when stopping modules
This commit is contained in:
parent
5796bde25d
commit
df93cabf22
@ -210,13 +210,16 @@ namespace modules {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void stop() {
|
void stop() {
|
||||||
if (!enabled())
|
std::lock_guard<threading_util::spin_lock> lck(this->update_lock);
|
||||||
return;
|
{
|
||||||
m_log.trace("%s: Stop", name());
|
if (!enabled())
|
||||||
enable(false);
|
return;
|
||||||
wakeup();
|
m_log.trace("%s: Stop", name());
|
||||||
if (!on_stop.empty())
|
enable(false);
|
||||||
on_stop.emit(name());
|
wakeup();
|
||||||
|
if (!on_stop.empty())
|
||||||
|
on_stop.emit(name());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void refresh() {
|
void refresh() {
|
||||||
|
@ -17,14 +17,6 @@ namespace modules {
|
|||||||
public:
|
public:
|
||||||
using timer_module::timer_module;
|
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() {
|
void setup() {
|
||||||
// Load configuration values
|
// Load configuration values
|
||||||
REQ_CONFIG_VALUE(name(), m_interface, "interface");
|
REQ_CONFIG_VALUE(name(), m_interface, "interface");
|
||||||
|
@ -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() {
|
bool has_event() {
|
||||||
// Poll for mixer and control events {{{
|
// Poll for mixer and control events {{{
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user