ICU-2787 Use uprv_getDefaultLocaleID in a thread safe manner, and with only one mutex lock
X-SVN-Rev: 12166
This commit is contained in:
parent
6fafcb3d65
commit
8c00b17191
@ -1508,6 +1508,7 @@ static const char *uprv_getPOSIXID(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* NOTE: The caller should handle thread safety */
|
||||
U_CAPI const char* U_EXPORT2
|
||||
uprv_getDefaultLocaleID()
|
||||
{
|
||||
@ -1615,12 +1616,10 @@ The leftmost codepage (.xxx) wins.
|
||||
posixID = uprv_strcpy(correctedPOSIXLocale, posixID);
|
||||
}
|
||||
|
||||
umtx_lock(NULL);
|
||||
if (gCorrectedPOSIXLocale == NULL) {
|
||||
gCorrectedPOSIXLocale = correctedPOSIXLocale;
|
||||
correctedPOSIXLocale = NULL;
|
||||
}
|
||||
umtx_unlock(NULL);
|
||||
|
||||
if (correctedPOSIXLocale != NULL) { /* Was already set - clean up. */
|
||||
uprv_free(correctedPOSIXLocale);
|
||||
|
Loading…
Reference in New Issue
Block a user