summaryrefslogtreecommitdiffstats
path: root/include/comphelper
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-04-24 22:40:08 +0200
committerStephan Bergmann <sbergman@redhat.com>2019-04-26 13:19:26 +0200
commit9b3eeff056793d38c7933a676cc471c4724b126f (patch)
tree04b9b5c89111ca1c2369b33ebcb79d8bc290c905 /include/comphelper
parentremove warning message (diff)
downloadcore-9b3eeff056793d38c7933a676cc471c4724b126f.tar.gz
core-9b3eeff056793d38c7933a676cc471c4724b126f.zip
SolarMutex::m_nThreadId is read without SolarMutex::m_aMutex locked
...so better make it std::atomic<> (and it also can be private). And in SolarMutex::doRelease, make sure that m_nCount is only read with m_aMutex locked. Change-Id: Iee0c1465e60e07ccd8955010a3dbc15a99dbe807 Reviewed-on: https://gerrit.libreoffice.org/71260 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'include/comphelper')
-rw-r--r--include/comphelper/solarmutex.hxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/comphelper/solarmutex.hxx b/include/comphelper/solarmutex.hxx
index 0c147f405560..4094e08ee1f7 100644
--- a/include/comphelper/solarmutex.hxx
+++ b/include/comphelper/solarmutex.hxx
@@ -23,6 +23,8 @@
#include <sal/config.h>
#include <assert.h>
+#include <atomic>
+
#include <osl/thread.h>
#include <osl/mutex.hxx>
#include <comphelper/comphelperdllapi.h>
@@ -68,9 +70,10 @@ protected:
osl::Mutex m_aMutex;
sal_uInt32 m_nCount;
- oslThreadIdentifier m_nThreadId;
private:
+ std::atomic<oslThreadIdentifier> m_nThreadId;
+
SolarMutex(const SolarMutex&) = delete;
SolarMutex& operator=(const SolarMutex&) = delete;