ProcStats : Use mutex lock to make fetch() thread safe.
Compare changes
Files
2+ 17
− 12
@@ -30,10 +30,6 @@
@@ -245,35 +241,39 @@ ProcStats* ProcStats::instance() {
@@ -310,5 +310,10 @@ bool ProcStats::fetch( procInfo& f ) {
Whilst investigating a possible memory issue using the Memory Auditor, I discovered the information printed was garbled if multiple threads where used.
The issue was the ProcStats::fetch
method which was not thread safe. This MR fixes that with a simple mutex lock.
I also did a drive-by cleanup and code modernisation.
FYI @clemenci