summaryrefslogtreecommitdiffstats
path: root/src/modules/SystemBackendProc/SystemBackendProc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/SystemBackendProc/SystemBackendProc.cpp')
-rw-r--r--src/modules/SystemBackendProc/SystemBackendProc.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/modules/SystemBackendProc/SystemBackendProc.cpp b/src/modules/SystemBackendProc/SystemBackendProc.cpp
index fb4d4e4..1a8c9c4 100644
--- a/src/modules/SystemBackendProc/SystemBackendProc.cpp
+++ b/src/modules/SystemBackendProc/SystemBackendProc.cpp
@@ -21,6 +21,8 @@
#include <Core/ThreadManager.h>
+#include <boost/thread/locks.hpp>
+
#include <cstdio>
#include <cstring>
@@ -31,6 +33,8 @@ namespace SystemBackendProc {
void SystemBackendProc::getUptimeInfo(unsigned long *uptime, unsigned long *idleTime) throw(Core::Exception) {
application->getThreadManager()->detach();
+ boost::lock_guard<boost::mutex> lock(uptimeMutex);
+
uptimeFile.seekg(0, std::ios::beg);
if(!uptimeFile.good())
@@ -52,6 +56,8 @@ void SystemBackendProc::getUptimeInfo(unsigned long *uptime, unsigned long *idle
void SystemBackendProc::getMemoryInfo(unsigned long *totalMem, unsigned long *freeMem, unsigned long *totalSwap, unsigned long *freeSwap) throw(Core::Exception) {
application->getThreadManager()->detach();
+ boost::lock_guard<boost::mutex> lock(meminfoMutex);
+
if(totalMem)
*totalMem = 0;
if(freeMem)
@@ -94,6 +100,8 @@ void SystemBackendProc::getMemoryInfo(unsigned long *totalMem, unsigned long *fr
void SystemBackendProc::getLoadInfo(unsigned long *currentLoad, unsigned long *nProcesses, float *loadAvg1, float *loadAvg5, float *loadAvg15) throw(Core::Exception) {
application->getThreadManager()->detach();
+ boost::lock_guard<boost::mutex> lock(loadMutex);
+
unsigned long currentLoadValue = 0, nProcessesValue = 0;
float loadAvg1Value = 0, loadAvg5Value = 0, loadAvg15Value = 0;