diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2018-11-04 20:31:58 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2018-11-05 13:26:36 +0100 |
commit | e07253e0262a11dc96a98598c55c43da16b9678a (patch) | |
tree | 5e803be171a4ec248ed5053258e3ea9d0a0f0e81 /connectivity | |
parent | 212ea275f21251903e449ba5a6b7c4fc2dc57642 (diff) |
replace double-checked locking patterns with thread safe local statics
Change-Id: I4ed97cc6d9f733292156d71551d5ce3af6071445
Reviewed-on: https://gerrit.libreoffice.org/62858
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/drivers/postgresql/pq_statics.cxx | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/connectivity/source/drivers/postgresql/pq_statics.cxx b/connectivity/source/drivers/postgresql/pq_statics.cxx index 0bec73919687..100c16c070f4 100644 --- a/connectivity/source/drivers/postgresql/pq_statics.cxx +++ b/connectivity/source/drivers/postgresql/pq_statics.cxx @@ -108,12 +108,7 @@ static cppu::IPropertyArrayHelper * createPropertyArrayHelper( Statics & getStatics() { - static Statics * p; - if( ! p ) - { - ::osl::MutexGuard guard( ::osl::Mutex::getGlobalMutex() ); - if( ! p ) - { + static Statics* p = []() { static Statics statics ; statics.SYSTEM_TABLE = "SYSTEM TABLE"; statics.TABLE = "TABLE"; @@ -665,9 +660,8 @@ Statics & getStatics() defTypeInfoMetaData[i].isAutoIncrement ) ); } - p = &statics; - } - } + return &statics; + }(); return *p; } |