summaryrefslogtreecommitdiff
path: root/comphelper/source/misc/comphelper_services.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-04-02 16:47:11 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-04-03 21:43:00 +0100
commit723e74b5dc8465e6910729c84a7ecc81262c7e37 (patch)
treecc85d887712369970177904ef5d0f62d444d3287 /comphelper/source/misc/comphelper_services.cxx
parent3dfc2de702491e86dfeaaebd789f2143da6e3658 (diff)
use rtl::Static where double-locked pattern used
Diffstat (limited to 'comphelper/source/misc/comphelper_services.cxx')
-rw-r--r--comphelper/source/misc/comphelper_services.cxx20
1 files changed, 14 insertions, 6 deletions
diff --git a/comphelper/source/misc/comphelper_services.cxx b/comphelper/source/misc/comphelper_services.cxx
index b9cc41fe5b09..32d1c53aff93 100644
--- a/comphelper/source/misc/comphelper_services.cxx
+++ b/comphelper/source/misc/comphelper_services.cxx
@@ -30,6 +30,8 @@
#include "comphelper_module.hxx"
+#include <rtl/instance.hxx>
+
//--------------------------------------------------------------------
extern void createRegistryInfo_OPropertyBag();
extern void createRegistryInfo_SequenceOutputStream();
@@ -49,13 +51,12 @@ namespace comphelper { namespace module
{
//........................................................................
- static void initializeModule()
+ namespace
{
- static bool bInitialized( false );
- if ( !bInitialized )
+ class doInitialize
{
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if ( !bInitialized )
+ public:
+ doInitialize()
{
createRegistryInfo_OPropertyBag();
createRegistryInfo_SequenceOutputStream();
@@ -70,7 +71,14 @@ namespace comphelper { namespace module
createRegistryInfo_OSimpleLogRing();
createRegistryInfo_OOfficeRestartManager();
}
- }
+ };
+
+ struct theInitializer : public rtl::Static< doInitialize, theInitializer > {};
+ }
+
+ static void initializeModule()
+ {
+ theInitializer::get();
}
//........................................................................