diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-04-24 22:40:08 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-04-26 13:19:26 +0200 |
commit | 9b3eeff056793d38c7933a676cc471c4724b126f (patch) | |
tree | 04b9b5c89111ca1c2369b33ebcb79d8bc290c905 /include/comphelper | |
parent | f214d664123b3b093f33eb5386867eab26bd8361 (diff) |
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.hxx | 5 |
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; |