mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-07 22:44:49 +00:00
ICU-3547 remove unnecessary umtx_init() calls.
X-SVN-Rev: 26224
This commit is contained in:
parent
47e71f0974
commit
ff17dd72c1
7 changed files with 5 additions and 44 deletions
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1997-2003, International Business Machines
|
||||
* Copyright (C) 1997-2009, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
|
@ -35,14 +35,6 @@ U_NAMESPACE_BEGIN
|
|||
//
|
||||
// UMTX myMutex;
|
||||
//
|
||||
// int InitializeMyMutex()
|
||||
// {
|
||||
// umtx_init( &myMutex );
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// static int initializeMyMutex = InitializeMyMutex();
|
||||
//
|
||||
// void Function(int arg1, int arg2)
|
||||
// {
|
||||
// static Object* foo; // Shared read-write object
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
******************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2001-2007, International Business Machines *
|
||||
* Copyright (C) 2001-2009, International Business Machines *
|
||||
* Corporation and others. All Rights Reserved. *
|
||||
* *
|
||||
******************************************************************************
|
||||
|
@ -62,8 +62,6 @@ u_cleanup(void)
|
|||
U_CAPI void U_EXPORT2
|
||||
u_init(UErrorCode *status) {
|
||||
UTRACE_ENTRY_OC(UTRACE_U_INIT);
|
||||
/* Make sure the global mutexes are initialized. */
|
||||
umtx_init(NULL);
|
||||
umtx_lock(&gICUInitMutex);
|
||||
if (gICUInitialized || U_FAILURE(*status)) {
|
||||
umtx_unlock(&gICUInitMutex);
|
||||
|
|
|
@ -202,10 +202,6 @@ static UBool U_CALLCONV usprep_cleanup(void){
|
|||
}
|
||||
U_CDECL_END
|
||||
|
||||
static void
|
||||
usprep_init() {
|
||||
umtx_init(&usprepMutex);
|
||||
}
|
||||
|
||||
/** Initializes the cache for resources */
|
||||
static void
|
||||
|
@ -429,8 +425,6 @@ usprep_open(const char* path,
|
|||
if(status == NULL || U_FAILURE(*status)){
|
||||
return NULL;
|
||||
}
|
||||
/* initialize the mutex */
|
||||
usprep_init();
|
||||
|
||||
/* initialize the profile struct members */
|
||||
return usprep_getProfile(path,name,status);
|
||||
|
|
|
@ -490,8 +490,6 @@ CollDataCache::CollDataCache(UErrorCode &status)
|
|||
return;
|
||||
}
|
||||
|
||||
umtx_init(&lock);
|
||||
|
||||
cache = uhash_open(uhash_hashChars, uhash_compareChars, uhash_compareLong, &status);
|
||||
|
||||
if (U_FAILURE(status)) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
**********************************************************************
|
||||
* Copyright (C) 1999-2008, International Business Machines
|
||||
* Copyright (C) 1999-2009, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
* Date Name Description
|
||||
|
@ -977,7 +977,6 @@ Transliterator* Transliterator::createBasicInstance(const UnicodeString& id,
|
|||
TransliteratorAlias* alias = 0;
|
||||
Transliterator* t = 0;
|
||||
|
||||
umtx_init(®istryMutex);
|
||||
umtx_lock(®istryMutex);
|
||||
if (HAVE_REGISTRY(ec)) {
|
||||
t = registry->get(id, alias, ec);
|
||||
|
@ -1216,7 +1215,6 @@ UnicodeSet& Transliterator::getTargetSet(UnicodeSet& result) const {
|
|||
void U_EXPORT2 Transliterator::registerFactory(const UnicodeString& id,
|
||||
Transliterator::Factory factory,
|
||||
Transliterator::Token context) {
|
||||
umtx_init(®istryMutex);
|
||||
Mutex lock(®istryMutex);
|
||||
UErrorCode ec = U_ZERO_ERROR;
|
||||
if (HAVE_REGISTRY(ec)) {
|
||||
|
@ -1256,7 +1254,6 @@ void Transliterator::_registerSpecialInverse(const UnicodeString& target,
|
|||
* @see #unregister
|
||||
*/
|
||||
void U_EXPORT2 Transliterator::registerInstance(Transliterator* adoptedPrototype) {
|
||||
umtx_init(®istryMutex);
|
||||
Mutex lock(®istryMutex);
|
||||
UErrorCode ec = U_ZERO_ERROR;
|
||||
if (HAVE_REGISTRY(ec)) {
|
||||
|
@ -1271,7 +1268,6 @@ void Transliterator::_registerInstance(Transliterator* adoptedPrototype) {
|
|||
|
||||
void U_EXPORT2 Transliterator::registerAlias(const UnicodeString& aliasID,
|
||||
const UnicodeString& realID) {
|
||||
umtx_init(®istryMutex);
|
||||
Mutex lock(®istryMutex);
|
||||
UErrorCode ec = U_ZERO_ERROR;
|
||||
if (HAVE_REGISTRY(ec)) {
|
||||
|
@ -1294,7 +1290,6 @@ void Transliterator::_registerAlias(const UnicodeString& aliasID,
|
|||
|
||||
*/
|
||||
void U_EXPORT2 Transliterator::unregister(const UnicodeString& ID) {
|
||||
umtx_init(®istryMutex);
|
||||
Mutex lock(®istryMutex);
|
||||
UErrorCode ec = U_ZERO_ERROR;
|
||||
if (HAVE_REGISTRY(ec)) {
|
||||
|
@ -1310,7 +1305,6 @@ void U_EXPORT2 Transliterator::unregister(const UnicodeString& ID) {
|
|||
*/
|
||||
int32_t U_EXPORT2 Transliterator::countAvailableIDs(void) {
|
||||
int32_t retVal = 0;
|
||||
umtx_init(®istryMutex);
|
||||
Mutex lock(®istryMutex);
|
||||
UErrorCode ec = U_ZERO_ERROR;
|
||||
if (HAVE_REGISTRY(ec)) {
|
||||
|
@ -1327,7 +1321,6 @@ int32_t U_EXPORT2 Transliterator::countAvailableIDs(void) {
|
|||
*/
|
||||
const UnicodeString& U_EXPORT2 Transliterator::getAvailableID(int32_t index) {
|
||||
const UnicodeString* result = NULL;
|
||||
umtx_init(®istryMutex);
|
||||
umtx_lock(®istryMutex);
|
||||
UErrorCode ec = U_ZERO_ERROR;
|
||||
if (HAVE_REGISTRY(ec)) {
|
||||
|
@ -1341,7 +1334,6 @@ const UnicodeString& U_EXPORT2 Transliterator::getAvailableID(int32_t index) {
|
|||
StringEnumeration* U_EXPORT2 Transliterator::getAvailableIDs(UErrorCode& ec) {
|
||||
if (U_FAILURE(ec)) return NULL;
|
||||
StringEnumeration* result = NULL;
|
||||
umtx_init(®istryMutex);
|
||||
umtx_lock(®istryMutex);
|
||||
if (HAVE_REGISTRY(ec)) {
|
||||
result = registry->getAvailableIDs();
|
||||
|
@ -1354,7 +1346,6 @@ StringEnumeration* U_EXPORT2 Transliterator::getAvailableIDs(UErrorCode& ec) {
|
|||
}
|
||||
|
||||
int32_t U_EXPORT2 Transliterator::countAvailableSources(void) {
|
||||
umtx_init(®istryMutex);
|
||||
Mutex lock(®istryMutex);
|
||||
UErrorCode ec = U_ZERO_ERROR;
|
||||
return HAVE_REGISTRY(ec) ? _countAvailableSources() : 0;
|
||||
|
@ -1362,7 +1353,6 @@ int32_t U_EXPORT2 Transliterator::countAvailableSources(void) {
|
|||
|
||||
UnicodeString& U_EXPORT2 Transliterator::getAvailableSource(int32_t index,
|
||||
UnicodeString& result) {
|
||||
umtx_init(®istryMutex);
|
||||
Mutex lock(®istryMutex);
|
||||
UErrorCode ec = U_ZERO_ERROR;
|
||||
if (HAVE_REGISTRY(ec)) {
|
||||
|
@ -1372,7 +1362,6 @@ UnicodeString& U_EXPORT2 Transliterator::getAvailableSource(int32_t index,
|
|||
}
|
||||
|
||||
int32_t U_EXPORT2 Transliterator::countAvailableTargets(const UnicodeString& source) {
|
||||
umtx_init(®istryMutex);
|
||||
Mutex lock(®istryMutex);
|
||||
UErrorCode ec = U_ZERO_ERROR;
|
||||
return HAVE_REGISTRY(ec) ? _countAvailableTargets(source) : 0;
|
||||
|
@ -1381,7 +1370,6 @@ int32_t U_EXPORT2 Transliterator::countAvailableTargets(const UnicodeString& sou
|
|||
UnicodeString& U_EXPORT2 Transliterator::getAvailableTarget(int32_t index,
|
||||
const UnicodeString& source,
|
||||
UnicodeString& result) {
|
||||
umtx_init(®istryMutex);
|
||||
Mutex lock(®istryMutex);
|
||||
UErrorCode ec = U_ZERO_ERROR;
|
||||
if (HAVE_REGISTRY(ec)) {
|
||||
|
@ -1392,7 +1380,6 @@ UnicodeString& U_EXPORT2 Transliterator::getAvailableTarget(int32_t index,
|
|||
|
||||
int32_t U_EXPORT2 Transliterator::countAvailableVariants(const UnicodeString& source,
|
||||
const UnicodeString& target) {
|
||||
umtx_init(®istryMutex);
|
||||
Mutex lock(®istryMutex);
|
||||
UErrorCode ec = U_ZERO_ERROR;
|
||||
return HAVE_REGISTRY(ec) ? _countAvailableVariants(source, target) : 0;
|
||||
|
@ -1402,7 +1389,6 @@ UnicodeString& U_EXPORT2 Transliterator::getAvailableVariant(int32_t index,
|
|||
const UnicodeString& source,
|
||||
const UnicodeString& target,
|
||||
UnicodeString& result) {
|
||||
umtx_init(®istryMutex);
|
||||
Mutex lock(®istryMutex);
|
||||
UErrorCode ec = U_ZERO_ERROR;
|
||||
if (HAVE_REGISTRY(ec)) {
|
||||
|
@ -1464,7 +1450,7 @@ UChar Transliterator::filteredCharAt(const Replaceable& text, int32_t i) const {
|
|||
* and return TRUE. If the registry cannot be initialized, return
|
||||
* FALSE (rare).
|
||||
*
|
||||
* IMPORTANT: Upon entry, registryMutex must be LOCKED. The entirely
|
||||
* IMPORTANT: Upon entry, registryMutex must be LOCKED. The entire
|
||||
* initialization is done with the lock held. There is NO REASON to
|
||||
* unlock, since no other thread that is waiting on the registryMutex
|
||||
* cannot itself proceed until the registry is initialized.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
**********************************************************************
|
||||
* Copyright (c) 2002-2008, International Business Machines Corporation
|
||||
* Copyright (c) 2002-2009, International Business Machines Corporation
|
||||
* and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
* Date Name Description
|
||||
|
@ -654,7 +654,6 @@ void TransliteratorIDParser::registerSpecialInverse(const UnicodeString& target,
|
|||
bidirectional = FALSE;
|
||||
}
|
||||
|
||||
umtx_init(&LOCK);
|
||||
Mutex lock(&LOCK);
|
||||
|
||||
UnicodeString *tempus = new UnicodeString(inverseTarget); // Used for null pointer check before usage.
|
||||
|
@ -856,7 +855,6 @@ TransliteratorIDParser::specsToSpecialInverse(const Specs& specs, UErrorCode &st
|
|||
|
||||
UnicodeString* inverseTarget;
|
||||
|
||||
umtx_init(&LOCK);
|
||||
umtx_lock(&LOCK);
|
||||
inverseTarget = (UnicodeString*) SPECIAL_INVERSES->get(specs.target);
|
||||
umtx_unlock(&LOCK);
|
||||
|
@ -911,7 +909,6 @@ void TransliteratorIDParser::init(UErrorCode &status) {
|
|||
}
|
||||
special_inverses->setValueDeleter(uhash_deleteUnicodeString);
|
||||
|
||||
umtx_init(&LOCK);
|
||||
umtx_lock(&LOCK);
|
||||
if (SPECIAL_INVERSES == NULL) {
|
||||
SPECIAL_INVERSES = special_inverses;
|
||||
|
|
|
@ -207,7 +207,6 @@ static UBool U_CALLCONV currency_cleanup(void);
|
|||
U_CDECL_END
|
||||
struct CReg;
|
||||
|
||||
/* Remember to call umtx_init(&gCRegLock) before using it! */
|
||||
static UMTX gCRegLock = 0;
|
||||
static CReg* gCRegHead = 0;
|
||||
|
||||
|
@ -234,7 +233,6 @@ struct CReg : public U_NAMESPACE_QUALIFIER UMemory {
|
|||
if (status && U_SUCCESS(*status) && _iso && _id) {
|
||||
CReg* n = new CReg(_iso, _id);
|
||||
if (n) {
|
||||
umtx_init(&gCRegLock);
|
||||
umtx_lock(&gCRegLock);
|
||||
if (!gCRegHead) {
|
||||
/* register for the first time */
|
||||
|
@ -252,7 +250,6 @@ struct CReg : public U_NAMESPACE_QUALIFIER UMemory {
|
|||
|
||||
static UBool unreg(UCurrRegistryKey key) {
|
||||
UBool found = FALSE;
|
||||
umtx_init(&gCRegLock);
|
||||
umtx_lock(&gCRegLock);
|
||||
|
||||
CReg** p = &gCRegHead;
|
||||
|
@ -272,7 +269,6 @@ struct CReg : public U_NAMESPACE_QUALIFIER UMemory {
|
|||
|
||||
static const UChar* get(const char* id) {
|
||||
const UChar* result = NULL;
|
||||
umtx_init(&gCRegLock);
|
||||
umtx_lock(&gCRegLock);
|
||||
CReg* p = gCRegHead;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue