summaryrefslogtreecommitdiff
path: root/cppu/source
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2009-02-12 09:18:09 +0000
committerOliver Bolte <obo@openoffice.org>2009-02-12 09:18:09 +0000
commit083eee51aba0e72a72cbac3c80cb5a34835b94e9 (patch)
treec31cdf382c4363289534202ad5e4cb825c2362da /cppu/source
parentbcf26e36bbdb1c48c91e351d3968d4600922d764 (diff)
CWS-TOOLING: integrate CWS sb103
2009-01-15 15:28:08 +0100 sb r266375 : #i97629# set UNO_PATH in python start program and use it in bootstrap function in officehelper.py (and do not erroneously encode a vnd.sun.star.pathname URE_BOOTSTRAP value in tools::extendApplicationEnvironment) 2009-01-15 10:40:17 +0100 sb r266338 : #i97424# explicit shut down of ImplImageTree singleton in DeInitVCL still required 2009-01-14 12:07:15 +0100 sb r266276 : CWS-TOOLING: rebase CWS sb103 to trunk@265758 (milestone: DEV300:m38) 2009-01-14 08:53:02 +0100 sb r266266 : #i96284# remove implementation of unused (but expensive) link feature; plus some general cleanup 2009-01-08 14:42:59 +0100 sb r266010 : #i96683# enable dlclose for GCC 3 (based on a patch by cmc) 2009-01-06 14:18:23 +0100 sb r265920 : #i97424# spurious unreferenced local variables 2008-12-19 15:33:39 +0100 sb r265727 : #i57359# no need for a special glibc 2.2.4 based libgcc_s.so.1 for URE any more as the general one used for OOo is guaranteed to be based on at least glibc 2.2.4, anyway 2008-12-19 13:54:37 +0100 sb r265724 : #i97424# clean up and speed up vcl ImplImageTree 2008-12-18 14:28:10 +0100 sb r265690 : #i97132# spread usage of the rtl::Static pattern (patch by cmc) 2008-12-15 14:33:00 +0100 sb r265499 : #i90492# generate UTF-8 encoded output (patch by tora) 2008-12-15 11:45:05 +0100 sb r265469 : #i95593# -Djava.library.path to find libtest_javauno_any.so 2008-12-15 11:23:14 +0100 sb r265468 : #i93769# it appears that Java nowadays expects file URIs in UTF-8, so ExternalUriReferenceTranslator.toExternal must not be called 2008-12-10 12:02:50 +0100 sb r265164 : #i93219# use (corrected) signal handling instead of forking again (to avoid unintended generation of core files)
Diffstat (limited to 'cppu/source')
-rw-r--r--cppu/source/typelib/static_types.cxx32
-rw-r--r--cppu/source/uno/lbenv.cxx22
2 files changed, 18 insertions, 36 deletions
diff --git a/cppu/source/typelib/static_types.cxx b/cppu/source/typelib/static_types.cxx
index f51c09797..197d15081 100644
--- a/cppu/source/typelib/static_types.cxx
+++ b/cppu/source/typelib/static_types.cxx
@@ -39,6 +39,7 @@
#include <rtl/ustring.hxx>
#include <rtl/ustrbuf.hxx>
#include <rtl/memory.h>
+#include <rtl/instance.hxx>
#include <typelib/typedescription.h>
@@ -114,19 +115,10 @@ static inline sal_Int32 newAlignedSize(
}
//--------------------------------------------------------------------------------------------------
-static Mutex & typelib_getStaticInitMutex() SAL_THROW( () )
+
+namespace
{
- static Mutex * s_pMutex = 0;
- if (! s_pMutex)
- {
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- if (! s_pMutex)
- {
- static Mutex s_aMutex;
- s_pMutex = &s_aMutex;
- }
- }
- return *s_pMutex;
+ struct typelib_StaticInitMutex : public rtl::Static< Mutex, typelib_StaticInitMutex > {};
}
// !for NOT REALLY WEAK TYPES only!
@@ -159,7 +151,7 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass(
if (! s_aTypes[eTypeClass])
{
- MutexGuard aGuard( typelib_getStaticInitMutex() );
+ MutexGuard aGuard( typelib_StaticInitMutex::get() );
if (! s_aTypes[eTypeClass])
{
static const char * s_aTypeNames[] = {
@@ -332,7 +324,7 @@ void SAL_CALL typelib_static_type_init(
{
if (! *ppRef)
{
- MutexGuard aGuard( typelib_getStaticInitMutex() );
+ MutexGuard aGuard( typelib_StaticInitMutex::get() );
if (! *ppRef)
{
OUString aTypeName( OUString::createFromAscii( pTypeName ) );
@@ -354,7 +346,7 @@ void SAL_CALL typelib_static_sequence_type_init(
{
if (! *ppRef)
{
- MutexGuard aGuard( typelib_getStaticInitMutex() );
+ MutexGuard aGuard( typelib_StaticInitMutex::get() );
if (! *ppRef)
{
OUStringBuffer aBuf( 32 );
@@ -398,7 +390,7 @@ void init(
if (! *ppRef)
{
- MutexGuard aGuard( typelib_getStaticInitMutex() );
+ MutexGuard aGuard( typelib_StaticInitMutex::get() );
if (! *ppRef)
{
OSL_ASSERT( ! TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK(eTypeClass) );
@@ -514,7 +506,7 @@ void SAL_CALL typelib_static_mi_interface_type_init(
{
if (! *ppRef)
{
- MutexGuard aGuard( typelib_getStaticInitMutex() );
+ MutexGuard aGuard( typelib_StaticInitMutex::get() );
if (! *ppRef)
{
OSL_ASSERT( ! TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK(typelib_TypeClass_INTERFACE) );
@@ -579,7 +571,7 @@ void SAL_CALL typelib_static_enum_type_init(
{
if (! *ppRef)
{
- MutexGuard aGuard( typelib_getStaticInitMutex() );
+ MutexGuard aGuard( typelib_StaticInitMutex::get() );
if (! *ppRef)
{
OSL_ASSERT( ! TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK(typelib_TypeClass_ENUM) );
@@ -621,7 +613,7 @@ void SAL_CALL typelib_static_array_type_init(
{
if (! *ppRef)
{
- MutexGuard aGuard( typelib_getStaticInitMutex() );
+ MutexGuard aGuard( typelib_StaticInitMutex::get() );
if (! *ppRef)
{
OUStringBuffer aBuf( 32 );
@@ -693,7 +685,7 @@ void SAL_CALL typelib_static_union_type_init(
{
if (! *ppRef)
{
- MutexGuard aGuard( typelib_getStaticInitMutex() );
+ MutexGuard aGuard( typelib_StaticInitMutex::get() );
if (! *ppRef)
{
OSL_ASSERT( ! TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK(typelib_TypeClass_UNION) );
diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx
index a14d09d5d..6eef3551a 100644
--- a/cppu/source/uno/lbenv.cxx
+++ b/cppu/source/uno/lbenv.cxx
@@ -44,6 +44,7 @@
#include "rtl/string.hxx"
#include "rtl/ustring.hxx"
#include "rtl/ustrbuf.hxx"
+#include "rtl/instance.hxx"
#include "typelib/typedescription.h"
#include "uno/dispatcher.h"
#include "uno/environment.h"
@@ -151,20 +152,9 @@ struct EnvironmentsData
uno_memAlloc memAlloc, const OUString & rEnvDcp );
};
-//------------------------------------------------------------------------------
-static EnvironmentsData & getEnvironmentsData()
+namespace
{
- static EnvironmentsData * s_p = 0;
- if (! s_p)
- {
- ::osl::MutexGuard guard( ::osl::Mutex::getGlobalMutex() );
- if (! s_p)
- {
- static EnvironmentsData s_obj;
- s_p = &s_obj;
- }
- }
- return *s_p;
+ struct theEnvironmentsData : public rtl::Static< EnvironmentsData, theEnvironmentsData > {};
}
//==============================================================================
@@ -610,7 +600,7 @@ static void SAL_CALL defenv_harden(
uno_DefaultEnvironment * that = (uno_DefaultEnvironment *)pEnv;
{
- ::osl::MutexGuard guard( getEnvironmentsData().mutex );
+ ::osl::MutexGuard guard( theEnvironmentsData::get().mutex );
if (1 == ::osl_incrementInterlockedCount( &that->nRef )) // is dead
{
that->nRef = 0;
@@ -1160,7 +1150,7 @@ void SAL_CALL uno_direct_getEnvironment(
OSL_ENSURE( ppEnv, "### null ptr!" );
OUString const & rEnvDcp = OUString::unacquired( &pEnvDcp );
- EnvironmentsData & rData = getEnvironmentsData();
+ EnvironmentsData & rData = theEnvironmentsData::get();
::osl::MutexGuard guard( rData.mutex );
rData.getEnvironment( ppEnv, rEnvDcp, pContext );
@@ -1181,7 +1171,7 @@ void SAL_CALL uno_getRegisteredEnvironments(
rtl_uString * pEnvDcp )
SAL_THROW_EXTERN_C()
{
- EnvironmentsData & rData = getEnvironmentsData();
+ EnvironmentsData & rData = theEnvironmentsData::get();
::osl::MutexGuard guard( rData.mutex );
rData.getRegisteredEnvironments(