diff options
author | Jochen Nitschke <j.nitschke+logerrit@ok.de> | 2018-07-29 18:22:19 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-29 23:05:31 +0200 |
commit | 1eeb8d34760e63c0ab2b52a27f43141bcde84297 (patch) | |
tree | 8b7d4f6455ad497425727f7f855ad774de619375 | |
parent | 3c28c44a7acc42e89b4012557ca7e51a870043c8 (diff) |
replace double checked locking patterns
with thread safe static initialization
Change-Id: I7b102e8a6aec64b0795f5fa915276ffc1f568d0a
Reviewed-on: https://gerrit.libreoffice.org/58288
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | connectivity/source/drivers/file/FTable.cxx | 14 | ||||
-rw-r--r-- | dbaccess/source/core/api/RowSet.cxx | 14 | ||||
-rw-r--r-- | dbaccess/source/core/api/table.cxx | 14 |
3 files changed, 9 insertions, 33 deletions
diff --git a/connectivity/source/drivers/file/FTable.cxx b/connectivity/source/drivers/file/FTable.cxx index e583e20db9af..0c805dbae645 100644 --- a/connectivity/source/drivers/file/FTable.cxx +++ b/connectivity/source/drivers/file/FTable.cxx @@ -124,17 +124,9 @@ void SAL_CALL OFileTable::disposing() Sequence< sal_Int8 > OFileTable::getUnoTunnelImplementationId() { - static ::cppu::OImplementationId * pId = nullptr; - if (! pId) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if (! pId) - { - static ::cppu::OImplementationId aId; - pId = &aId; - } - } - return pId->getImplementationId(); + static ::cppu::OImplementationId s_Id; + + return s_Id.getImplementationId(); } // css::lang::XUnoTunnel diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index 0ce715ed1a8a..69414a73b34f 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -456,17 +456,9 @@ sal_Int64 SAL_CALL ORowSet::getSomething( const Sequence< sal_Int8 >& rId ) Sequence< sal_Int8 > ORowSet::getUnoTunnelImplementationId() { - static ::cppu::OImplementationId * pId = nullptr; - if (! pId) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if (! pId) - { - static ::cppu::OImplementationId aId; - pId = &aId; - } - } - return pId->getImplementationId(); + static ::cppu::OImplementationId s_Id; + + return s_Id.getImplementationId(); } // css::XAggregation diff --git a/dbaccess/source/core/api/table.cxx b/dbaccess/source/core/api/table.cxx index 3590e93613aa..348c61ded3ac 100644 --- a/dbaccess/source/core/api/table.cxx +++ b/dbaccess/source/core/api/table.cxx @@ -312,17 +312,9 @@ sal_Int64 SAL_CALL ODBTable::getSomething( const Sequence< sal_Int8 >& rId ) Sequence< sal_Int8 > ODBTable::getUnoTunnelImplementationId() { - static ::cppu::OImplementationId * pId = nullptr; - if (! pId) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if (! pId) - { - static ::cppu::OImplementationId aId; - pId = &aId; - } - } - return pId->getImplementationId(); + static ::cppu::OImplementationId s_Id; + + return s_Id.getImplementationId(); } Reference< XPropertySet > ODBTable::createColumnDescriptor() |