diff --git a/bin/resource-monitor b/bin/resource-monitor index e4ab974..3b2784f 100755 Binary files a/bin/resource-monitor and b/bin/resource-monitor differ diff --git a/libsys/cpu.cpp b/libsys/cpu.cpp index 879e4b9..1c2268c 100644 --- a/libsys/cpu.cpp +++ b/libsys/cpu.cpp @@ -170,7 +170,10 @@ std::vector CPU::CPU_CORE_PERCENT() { } CPU::~CPU() { - this->m_isPolling = false; - m_pollThread->join(); + std::cout << "CPU Destructed" << std::endl; + if (this->m_isPolling) { + this->m_isPolling = false; + m_pollThread->join(); + } delete m_pollThread; } diff --git a/libsys/cpu.h b/libsys/cpu.h index 6713ff6..f41b41c 100644 --- a/libsys/cpu.h +++ b/libsys/cpu.h @@ -19,7 +19,8 @@ struct CPUStat { class CPU { public: CPU(); - + static CPU* Create(); + std::mutex CPU_Mutex; CPUStat* cpuStat; CPUStat getCPUStat(); @@ -50,3 +51,9 @@ private: }; static CPU* CPU_Instance; + +class CPUFactory { +public: + +private: +}; diff --git a/libsys/memstat.cpp b/libsys/memstat.cpp index 55d44d9..dfbb7ac 100644 --- a/libsys/memstat.cpp +++ b/libsys/memstat.cpp @@ -84,7 +84,10 @@ void Memory::END_MEMORY_POLLING() { } Memory::~Memory() { - this->m_isPolling = false; - m_pollThread->join(); + std::cout << "Memory Destructed" << std::endl; + if (this->m_isPolling) { + m_pollThread->join(); + this->m_isPolling = false; + } delete m_pollThread; }