diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-11-08 10:31:49 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-11-08 14:17:16 +0100 |
commit | 77b5129078906e52f15e2a5c0fdefe934ef13d0c (patch) | |
tree | 228b16bbdb9187acfb01f0bc846f864b3f385332 /comphelper | |
parent | 35b6f75bc14fe65c4700e199d82c958f715420ac (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 'comphelper')
-rw-r--r-- | comphelper/source/misc/profilezone.cxx | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/comphelper/source/misc/profilezone.cxx b/comphelper/source/misc/profilezone.cxx index dc2a713228b8..72d9bcde06b9 100644 --- a/comphelper/source/misc/profilezone.cxx +++ b/comphelper/source/misc/profilezone.cxx @@ -7,6 +7,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include <sal/config.h> + +#include <atomic> + #include <comphelper/sequence.hxx> #include <comphelper/profilezone.hxx> #include <osl/time.h> @@ -15,7 +19,7 @@ namespace comphelper { -volatile bool ProfileZone::g_bRecording(false); +std::atomic<bool> ProfileZone::g_bRecording(false); namespace ProfileRecording { |