ICU-7158 Remove non-static UMTX objects from ICU4C
X-SVN-Rev: 29701
This commit is contained in:
parent
2e4d76da6f
commit
90412460c5
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2001-2010, International Business Machines Corporation.
|
||||
* Copyright (C) 2001-2011, International Business Machines Corporation.
|
||||
* All Rights Reserved.
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -327,28 +327,26 @@ U_CDECL_END
|
||||
******************************************************************
|
||||
*/
|
||||
|
||||
static UMTX lock;
|
||||
|
||||
ICUService::ICUService()
|
||||
: name()
|
||||
, lock(0)
|
||||
, timestamp(0)
|
||||
, factories(NULL)
|
||||
, serviceCache(NULL)
|
||||
, idCache(NULL)
|
||||
, dnCache(NULL)
|
||||
{
|
||||
umtx_init(&lock);
|
||||
}
|
||||
|
||||
ICUService::ICUService(const UnicodeString& newName)
|
||||
: name(newName)
|
||||
, lock(0)
|
||||
, timestamp(0)
|
||||
, factories(NULL)
|
||||
, serviceCache(NULL)
|
||||
, idCache(NULL)
|
||||
, dnCache(NULL)
|
||||
{
|
||||
umtx_init(&lock);
|
||||
}
|
||||
|
||||
ICUService::~ICUService()
|
||||
@ -359,7 +357,6 @@ ICUService::~ICUService()
|
||||
delete factories;
|
||||
factories = NULL;
|
||||
}
|
||||
umtx_destroy(&lock);
|
||||
}
|
||||
|
||||
UObject*
|
||||
@ -446,7 +443,7 @@ ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUSer
|
||||
// if factory is not null, we're calling from within the mutex,
|
||||
// and since some unix machines don't have reentrant mutexes we
|
||||
// need to make sure not to try to lock it again.
|
||||
XMutex mutex(&ncthis->lock, factory != NULL);
|
||||
XMutex mutex(&lock, factory != NULL);
|
||||
|
||||
if (serviceCache == NULL) {
|
||||
ncthis->serviceCache = new Hashtable(status);
|
||||
@ -612,9 +609,8 @@ ICUService::getVisibleIDs(UVector& result, const UnicodeString* matchID, UErrorC
|
||||
return result;
|
||||
}
|
||||
|
||||
ICUService * ncthis = (ICUService*)this; // cast away semantic const
|
||||
{
|
||||
Mutex mutex(&ncthis->lock);
|
||||
Mutex mutex(&lock);
|
||||
const Hashtable* map = getVisibleIDMap(status);
|
||||
if (map != NULL) {
|
||||
ICUServiceKey* fallbackKey = createKey(matchID, status);
|
||||
@ -690,9 +686,8 @@ UnicodeString&
|
||||
ICUService::getDisplayName(const UnicodeString& id, UnicodeString& result, const Locale& locale) const
|
||||
{
|
||||
{
|
||||
ICUService* ncthis = (ICUService*)this; // cast away semantic const
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
Mutex mutex(&ncthis->lock);
|
||||
Mutex mutex(&lock);
|
||||
const Hashtable* map = getVisibleIDMap(status);
|
||||
if (map != NULL) {
|
||||
ICUServiceFactory* f = (ICUServiceFactory*)map->get(id);
|
||||
@ -744,7 +739,7 @@ ICUService::getDisplayNames(UVector& result,
|
||||
result.setDeleter(userv_deleteStringPair);
|
||||
if (U_SUCCESS(status)) {
|
||||
ICUService* ncthis = (ICUService*)this; // cast away semantic const
|
||||
Mutex mutex(&ncthis->lock);
|
||||
Mutex mutex(&lock);
|
||||
|
||||
if (dnCache != NULL && dnCache->locale != locale) {
|
||||
delete dnCache;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2001-2007, International Business Machines Corporation. *
|
||||
* Copyright (C) 2001-2011, International Business Machines Corporation. *
|
||||
* All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -527,11 +527,6 @@ class U_COMMON_API ICUService : public ICUNotifier {
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* single lock used by this service.
|
||||
*/
|
||||
UMTX lock;
|
||||
|
||||
/**
|
||||
* Timestamp so iterators can be fail-fast.
|
||||
*/
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2001-2005, International Business Machines Corporation and *
|
||||
* Copyright (C) 2001-2011, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*
|
||||
@ -425,7 +425,6 @@ class U_COMMON_API ICULocaleService : public ICUService
|
||||
private:
|
||||
Locale fallbackLocale;
|
||||
UnicodeString fallbackLocaleName;
|
||||
UMTX llock;
|
||||
|
||||
public:
|
||||
/**
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2001-2004, International Business Machines Corporation and *
|
||||
* Copyright (C) 2001-2011, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*
|
||||
@ -26,24 +26,20 @@
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
static UMTX llock;
|
||||
ICULocaleService::ICULocaleService()
|
||||
: fallbackLocale(Locale::getDefault())
|
||||
, llock(0)
|
||||
{
|
||||
umtx_init(&llock);
|
||||
}
|
||||
|
||||
ICULocaleService::ICULocaleService(const UnicodeString& dname)
|
||||
: ICUService(dname)
|
||||
, fallbackLocale(Locale::getDefault())
|
||||
, llock(0)
|
||||
{
|
||||
umtx_init(&llock);
|
||||
}
|
||||
|
||||
ICULocaleService::~ICULocaleService()
|
||||
{
|
||||
umtx_destroy(&llock);
|
||||
}
|
||||
|
||||
UObject*
|
||||
@ -267,7 +263,7 @@ ICULocaleService::validateFallbackLocale() const
|
||||
const Locale& loc = Locale::getDefault();
|
||||
ICULocaleService* ncThis = (ICULocaleService*)this;
|
||||
{
|
||||
Mutex mutex(&ncThis->llock);
|
||||
Mutex mutex(&llock);
|
||||
if (loc != fallbackLocale) {
|
||||
ncThis->fallbackLocale = loc;
|
||||
LocaleUtility::initNameFromLocale(loc, ncThis->fallbackLocaleName);
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2001-2006, International Business Machines Corporation and *
|
||||
* Copyright (C) 2001-2011, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -19,10 +19,11 @@ U_NAMESPACE_BEGIN
|
||||
EventListener::~EventListener() {}
|
||||
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(EventListener)
|
||||
|
||||
static UMTX notifyLock;
|
||||
|
||||
ICUNotifier::ICUNotifier(void)
|
||||
: notifyLock(0), listeners(NULL)
|
||||
: listeners(NULL)
|
||||
{
|
||||
umtx_init(¬ifyLock);
|
||||
}
|
||||
|
||||
ICUNotifier::~ICUNotifier(void) {
|
||||
@ -31,7 +32,6 @@ ICUNotifier::~ICUNotifier(void) {
|
||||
delete listeners;
|
||||
listeners = NULL;
|
||||
}
|
||||
umtx_destroy(¬ifyLock);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2001-2004, International Business Machines Corporation and *
|
||||
* Copyright (C) 2001-2011, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -70,7 +70,6 @@ public:
|
||||
*/
|
||||
|
||||
class U_COMMON_API ICUNotifier : public UMemory {
|
||||
private: UMTX notifyLock;
|
||||
private: UVector* listeners;
|
||||
|
||||
public:
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
******************************************************************************
|
||||
* Copyright (C) 1996-2009, International Business Machines *
|
||||
* Copyright (C) 1996-2011, International Business Machines *
|
||||
* Corporation and others. All Rights Reserved. *
|
||||
******************************************************************************
|
||||
*/
|
||||
@ -463,9 +463,9 @@ private:
|
||||
static char *getKey(UCollator *collator, char *keyBuffer, int32_t *charBufferLength);
|
||||
static void deleteKey(char *key);
|
||||
|
||||
UMTX lock;
|
||||
UHashtable *cache;
|
||||
};
|
||||
static UMTX lock;
|
||||
|
||||
U_CFUNC void deleteChars(void * /*obj*/)
|
||||
{
|
||||
@ -484,7 +484,7 @@ U_CFUNC void deleteCollDataCacheEntry(void *obj)
|
||||
}
|
||||
|
||||
CollDataCache::CollDataCache(UErrorCode &status)
|
||||
: lock(0), cache(NULL)
|
||||
: cache(NULL)
|
||||
{
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
@ -506,8 +506,6 @@ CollDataCache::~CollDataCache()
|
||||
uhash_close(cache);
|
||||
cache = NULL;
|
||||
umtx_unlock(&lock);
|
||||
|
||||
umtx_destroy(&lock);
|
||||
}
|
||||
|
||||
CollData *CollDataCache::get(UCollator *collator, UErrorCode &status)
|
||||
|
Loading…
Reference in New Issue
Block a user