diff options
author | Jochen Nitschke <j.nitschke+logerrit@ok.de> | 2017-06-17 14:01:36 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-17 15:43:38 +0200 |
commit | 6149da20ddee5c0c50b445fb6a4e3e81b5ff900b (patch) | |
tree | 7cfca9c16dff522f0c0e15809f9fe4b926078698 /ucb | |
parent | 470752f50c146b449b1c9bdccc36ed031535663c (diff) |
replace misc double checked locking patterns
... with thread safe local statics
Change-Id: Ie3c8023776a388846b989f00a0be185273c0d5da
Reviewed-on: https://gerrit.libreoffice.org/38907
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'ucb')
-rw-r--r-- | ucb/source/sorter/sortdynres.cxx | 13 | ||||
-rw-r--r-- | ucb/source/sorter/sortresult.cxx | 13 |
2 files changed, 4 insertions, 22 deletions
diff --git a/ucb/source/sorter/sortdynres.cxx b/ucb/source/sorter/sortdynres.cxx index caa5f97afc72..c62f102cc0d2 100644 --- a/ucb/source/sorter/sortdynres.cxx +++ b/ucb/source/sorter/sortdynres.cxx @@ -40,18 +40,9 @@ using namespace comphelper; // The mutex to synchronize access to containers. static osl::Mutex& getContainerMutex() { - static osl::Mutex* pMutex = nullptr; - if( !pMutex ) - { - osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); - if( !pMutex ) - { - static osl::Mutex aMutex; - pMutex = &aMutex; - } - } + static osl::Mutex ourMutex; - return *pMutex; + return ourMutex; } diff --git a/ucb/source/sorter/sortresult.cxx b/ucb/source/sorter/sortresult.cxx index 154dc099831c..f842c45f78a6 100644 --- a/ucb/source/sorter/sortresult.cxx +++ b/ucb/source/sorter/sortresult.cxx @@ -49,18 +49,9 @@ using namespace cppu; // The mutex to synchronize access to containers. static osl::Mutex& getContainerMutex() { - static osl::Mutex* pMutex = nullptr; - if( !pMutex ) - { - osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); - if( !pMutex ) - { - static osl::Mutex aMutex; - pMutex = &aMutex; - } - } + static osl::Mutex ourMutex; - return *pMutex; + return ourMutex; } |