From 6b6bcf5080d8dce0e6e501da3f43d5a39f7fb6e3 Mon Sep 17 00:00:00 2001
From: patrick96
Date: Thu, 30 Sep 2021 15:11:31 +0200
Subject: [PATCH] Stop ipc_module subclassing static_module
---
include/modules/ipc.hpp | 2 +-
src/modules/ipc.cpp | 9 +++++++--
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/include/modules/ipc.hpp b/include/modules/ipc.hpp
index 5a5a1100..5100736d 100644
--- a/include/modules/ipc.hpp
+++ b/include/modules/ipc.hpp
@@ -12,7 +12,7 @@ namespace modules {
* shell script and the resulting output will be used
* as the module content.
*/
- class ipc_module : public static_module {
+ class ipc_module : public module {
public:
/**
* Hook structure that will be fired
diff --git a/src/modules/ipc.cpp b/src/modules/ipc.cpp
index 68d51fe7..53b325e3 100644
--- a/src/modules/ipc.cpp
+++ b/src/modules/ipc.cpp
@@ -14,7 +14,7 @@ namespace modules {
* Load user-defined ipc hooks and
* create formatting tags
*/
- ipc_module::ipc_module(const bar_settings& bar, string name_) : static_module(bar, move(name_)) {
+ ipc_module::ipc_module(const bar_settings& bar, string name_) : module(bar, move(name_)) {
m_router->register_action_with_data(EVENT_SEND, &ipc_module::action_send);
size_t index = 0;
@@ -56,13 +56,18 @@ namespace modules {
* Start module and run first defined hook if configured to
*/
void ipc_module::start() {
+ m_mainthread = thread([&] {
+ m_log.trace("%s: Thread id = %i", this->name(), concurrency_util::thread_id(this_thread::get_id()));
+ update();
+ broadcast();
+ });
+
if (m_initial) {
// TODO do this in a thread.
auto command = command_util::make_command(m_hooks.at(m_initial - 1)->command);
command->exec(false);
command->tail([this](string line) { m_output = line; });
}
- static_module::start();
}
/**