From 49c6d824994d7e5b81826cde414075d00dc75565 Mon Sep 17 00:00:00 2001 From: Kurt Zenker Date: Thu, 25 Mar 2004 13:47:43 +0000 Subject: INTEGRATION: CWS jl3 (1.1.82); FILE MERGED 2003/12/19 11:32:28 dbo 1.1.82.1: #114506# cleanup --- stoc/source/registry_tdprovider/td.cxx | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/stoc/source/registry_tdprovider/td.cxx b/stoc/source/registry_tdprovider/td.cxx index c86848b13a8d..e1651fa98f37 100644 --- a/stoc/source/registry_tdprovider/td.cxx +++ b/stoc/source/registry_tdprovider/td.cxx @@ -2,9 +2,9 @@ * * $RCSfile: td.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: kso $ $Date: 2002-11-11 08:35:46 $ + * last change: $Author: kz $ $Date: 2004-03-25 14:47:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -59,12 +59,36 @@ * ************************************************************************/ +#include "osl/doublecheckedlocking.h" #ifndef _STOC_RDBTDP_BASE_HXX #include "base.hxx" #endif namespace stoc_rdbtdp { + +//------------------------------------------------------------------------------ +::osl::Mutex & getMutex() +{ + static ::osl::Mutex * s_pmutex = 0; + if (s_pmutex == 0) + { + ::osl::MutexGuard guard( ::osl::Mutex::getGlobalMutex() ); + if (s_pmutex == 0) + { + static ::osl::Mutex s_mutex; + OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER(); + s_pmutex = &s_mutex; + } + } + else + { + OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER(); + } + return *s_pmutex; +} + + TypeDescriptionImpl::~TypeDescriptionImpl() { g_moduleCount.modCnt.release( &g_moduleCount.modCnt ); -- cgit