summaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/SystemBackendPosix.cpp7
-rw-r--r--src/modules/SystemBackendProc.cpp10
2 files changed, 10 insertions, 7 deletions
diff --git a/src/modules/SystemBackendPosix.cpp b/src/modules/SystemBackendPosix.cpp
index d34b2c8..c8135a3 100644
--- a/src/modules/SystemBackendPosix.cpp
+++ b/src/modules/SystemBackendPosix.cpp
@@ -20,6 +20,7 @@
#include "SystemBackendPosix.h"
#include <Net/FdManager.h>
+#include <Common/ActionManager.h>
#include <cstdio>
#include <cstdlib>
@@ -113,13 +114,11 @@ void SystemBackendPosix::childHandler(int) {
int status;
pid_t pid;
- // TODO Don't call callbacks directly
-
while((pid = waitpid(-1, &status, WNOHANG)) > 0) {
std::map<pid_t, sigc::slot<void, int> >::iterator it = processes.find(pid);
if(it != processes.end()) {
- it->second(status);
+ Common::ActionManager::get()->add(sigc::bind(it->second, status));
processes.erase(it);
}
else {
@@ -137,7 +136,7 @@ void SystemBackendPosix::childHandler(int) {
Net::FdManager::get()->unregisterFd(handle);
close(handle);
- it2->second(status, output);
+ Common::ActionManager::get()->add(sigc::bind(it2->second, status, output));
processesWithOutput.erase(it2);
processesWOHandles.erase(pid);
processesWOOutput.erase(pid);
diff --git a/src/modules/SystemBackendProc.cpp b/src/modules/SystemBackendProc.cpp
index 1af2f28..3a0d33d 100644
--- a/src/modules/SystemBackendProc.cpp
+++ b/src/modules/SystemBackendProc.cpp
@@ -19,9 +19,13 @@
#include "SystemBackendProc.h"
+#include <Common/ActionManager.h>
+
#include <cstdio>
#include <cstring>
+#include <sigc++/bind.h>
+
#define init SystemBackendProc_LTX_init
#define deinit SystemBackendProc_LTX_deinit
@@ -49,7 +53,7 @@ bool SystemBackendProc::uptimeInfo(const sigc::slot<void, unsigned long, unsigne
if(uptimeFile.good())
idleTime = (unsigned long)f;
- callback(uptime, idleTime);
+ Common::ActionManager::get()->add(sigc::bind(callback, uptime, idleTime));
return true;
}
@@ -86,7 +90,7 @@ bool SystemBackendProc::memoryInfo(const sigc::slot<void, unsigned long, unsigne
break;
}
- callback(totalMem, freeMem, totalSwap, freeSwap);
+ Common::ActionManager::get()->add(sigc::bind(callback, totalMem, freeMem, totalSwap, freeSwap));
return true;
}
@@ -108,7 +112,7 @@ bool SystemBackendProc::loadInfo(const sigc::slot<void, unsigned long, unsigned
std::sscanf(line.c_str(), "%f %f %f %lu/%lu", &loadAvg1, &loadAvg5, &loadAvg15, &currentLoad, &nProcesses);
- callback(currentLoad, nProcesses, loadAvg1, loadAvg5, loadAvg15);
+ Common::ActionManager::get()->add(sigc::bind(callback, currentLoad, nProcesses, loadAvg1, loadAvg5, loadAvg15));
return true;
}