fix: Acquire lock when stopping modules
This commit is contained in:
parent
5796bde25d
commit
df93cabf22
@ -210,6 +210,8 @@ namespace modules {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void stop() {
|
void stop() {
|
||||||
|
std::lock_guard<threading_util::spin_lock> lck(this->update_lock);
|
||||||
|
{
|
||||||
if (!enabled())
|
if (!enabled())
|
||||||
return;
|
return;
|
||||||
m_log.trace("%s: Stop", name());
|
m_log.trace("%s: Stop", name());
|
||||||
@ -218,6 +220,7 @@ namespace modules {
|
|||||||
if (!on_stop.empty())
|
if (!on_stop.empty())
|
||||||
on_stop.emit(name());
|
on_stop.emit(name());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void refresh() {
|
void refresh() {
|
||||||
m_cache = CAST_MODULE(Impl)->get_output();
|
m_cache = CAST_MODULE(Impl)->get_output();
|
||||||
|
@ -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