diff options
Diffstat (limited to 'deps/icu-small/source/common/serv.cpp')
-rw-r--r-- | deps/icu-small/source/common/serv.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/deps/icu-small/source/common/serv.cpp b/deps/icu-small/source/common/serv.cpp index 40940740d0..044864b859 100644 --- a/deps/icu-small/source/common/serv.cpp +++ b/deps/icu-small/source/common/serv.cpp @@ -333,10 +333,7 @@ U_CDECL_END ****************************************************************** */ -static UMutex *lock() { - static UMutex m = U_MUTEX_INITIALIZER; - return &m; -} +static UMutex lock; ICUService::ICUService() : name() @@ -361,7 +358,7 @@ ICUService::ICUService(const UnicodeString& newName) ICUService::~ICUService() { { - Mutex mutex(lock()); + Mutex mutex(&lock); clearCaches(); delete factories; factories = NULL; @@ -452,7 +449,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(lock(), factory != NULL); + XMutex mutex(&lock, factory != NULL); if (serviceCache == NULL) { ncthis->serviceCache = new Hashtable(status); @@ -618,7 +615,7 @@ ICUService::getVisibleIDs(UVector& result, const UnicodeString* matchID, UErrorC } { - Mutex mutex(lock()); + Mutex mutex(&lock); const Hashtable* map = getVisibleIDMap(status); if (map != NULL) { ICUServiceKey* fallbackKey = createKey(matchID, status); @@ -695,7 +692,7 @@ ICUService::getDisplayName(const UnicodeString& id, UnicodeString& result, const { { UErrorCode status = U_ZERO_ERROR; - Mutex mutex(lock()); + Mutex mutex(&lock); const Hashtable* map = getVisibleIDMap(status); if (map != NULL) { ICUServiceFactory* f = (ICUServiceFactory*)map->get(id); @@ -747,7 +744,7 @@ ICUService::getDisplayNames(UVector& result, result.setDeleter(userv_deleteStringPair); if (U_SUCCESS(status)) { ICUService* ncthis = (ICUService*)this; // cast away semantic const - Mutex mutex(lock()); + Mutex mutex(&lock); if (dnCache != NULL && dnCache->locale != locale) { delete dnCache; @@ -852,7 +849,7 @@ URegistryKey ICUService::registerFactory(ICUServiceFactory* factoryToAdopt, UErrorCode& status) { if (U_SUCCESS(status) && factoryToAdopt != NULL) { - Mutex mutex(lock()); + Mutex mutex(&lock); if (factories == NULL) { factories = new UVector(deleteUObject, NULL, status); @@ -883,7 +880,7 @@ ICUService::unregister(URegistryKey rkey, UErrorCode& status) ICUServiceFactory *factory = (ICUServiceFactory*)rkey; UBool result = FALSE; if (factory != NULL && factories != NULL) { - Mutex mutex(lock()); + Mutex mutex(&lock); if (factories->removeElement(factory)) { clearCaches(); @@ -903,7 +900,7 @@ void ICUService::reset() { { - Mutex mutex(lock()); + Mutex mutex(&lock); reInitializeFactories(); clearCaches(); } |