summaryrefslogtreecommitdiff
path: root/include/comphelper/profilezone.hxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-11-08 10:31:49 +0100
committerStephan Bergmann <sbergman@redhat.com>2018-11-08 14:17:16 +0100
commit77b5129078906e52f15e2a5c0fdefe934ef13d0c (patch)
tree228b16bbdb9187acfb01f0bc846f864b3f385332 /include/comphelper/profilezone.hxx
parent35b6f75bc14fe65c4700e199d82c958f715420ac (diff)
coverity#1441101: Use std::atomic instead of volatile
ee9ccdf6ecd944c2f448a30d10700754d1f0cfa2 "reduce cost of ProfileZone when it is not active" had changed g_bRecording from a bool guarded by g_aMutex to a volatile bool. But having been guarded by a mutex indicates that g_bRecording is potentially accessed from multiple threads, and volatile does not avoid races. Change-Id: I933ff5d912cbc7acce52155c605d9c19049c66aa Reviewed-on: https://gerrit.libreoffice.org/63073 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'include/comphelper/profilezone.hxx')
-rw-r--r--include/comphelper/profilezone.hxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/include/comphelper/profilezone.hxx b/include/comphelper/profilezone.hxx
index 9def6f994fba..8cbc078f6621 100644
--- a/include/comphelper/profilezone.hxx
+++ b/include/comphelper/profilezone.hxx
@@ -10,6 +10,10 @@
#ifndef INCLUDED_COMPHELPER_PROFILEZONE_HXX
#define INCLUDED_COMPHELPER_PROFILEZONE_HXX
+#include <sal/config.h>
+
+#include <atomic>
+
#include <com/sun/star/uno/Sequence.h>
#include <comphelper/comphelperdllapi.h>
#include <rtl/ustring.hxx>
@@ -36,7 +40,7 @@ private:
const char * m_sProfileId;
long long const m_aCreateTime;
public:
- static volatile bool g_bRecording; // true during recording
+ static std::atomic<bool> g_bRecording; // true during recording
// Note that the char pointer is stored as such in the ProfileZone object and used in the
// destructor, so be sure to pass a pointer that stays valid for the duration of the object's