From 2c7af2a60cf056536a4c80acc4172ec1ff2359b5 Mon Sep 17 00:00:00 2001
From: patrick96
Date: Sat, 11 Sep 2021 15:58:18 +0200
Subject: [PATCH] Store reload flag in controller
---
include/components/controller.hpp | 8 ++++++++
src/components/controller.cpp | 26 ++++++++++++++------------
2 files changed, 22 insertions(+), 12 deletions(-)
diff --git a/include/components/controller.hpp b/include/components/controller.hpp
index bcf9741a..f56edfef 100644
--- a/include/components/controller.hpp
+++ b/include/components/controller.hpp
@@ -63,10 +63,13 @@ class controller : public signal_receiver(input_data);
- // TODO create function for this
- UV(uv_async_send, m_notifier.get());
+ trigger_notification();
} else {
m_log.trace("controller: Swallowing input event (pending data)");
}
@@ -148,8 +145,7 @@ void controller::trigger_quit(bool reload) {
std::unique_lock guard(m_notification_mutex);
m_notifications.quit = true;
m_notifications.reload = m_notifications.reload || reload;
- // TODO create function for this
- UV(uv_async_send, m_notifier.get());
+ trigger_notification();
}
void controller::trigger_update(bool force) {
@@ -159,13 +155,16 @@ void controller::trigger_update(bool force) {
// TODO this isn't really safe
if (m_notifier) {
- // TODO create function for this
- UV(uv_async_send, m_notifier.get());
+ trigger_notification();
}
}
+void controller::trigger_notification() {
+ UV(uv_async_send, m_notifier.get());
+}
+
void controller::stop(bool reload) {
- g_reload = reload;
+ update_reload(reload);
eloop->stop();
}
@@ -225,8 +224,7 @@ void controller::notifier_handler() {
}
if (data.quit) {
- // TODO store this in the instance
- g_reload = data.reload;
+ update_reload(data.reload);
eloop->stop();
return;
}
@@ -607,6 +605,10 @@ bool controller::process_update(bool force) {
return true;
}
+void controller::update_reload(bool reload) {
+ m_reload = m_reload || reload;
+}
+
/**
* Creates module instances for all the modules in the given alignment block
*/