ICU-2821 try to work around sync bug on unix?

X-SVN-Rev: 11736
This commit is contained in:
Doug Felt 2003-04-30 00:17:54 +00:00
parent 702ddea7c2
commit 0ae75b6ac7

View File

@ -412,15 +412,22 @@ public:
// ------------------------------------- // -------------------------------------
static UMTX gLock = 0; static UMTX gnLock = 0;
static ICULocaleService* static ICULocaleService*
getService(void) getService(void)
{ {
if (gService == NULL) { if (gService == NULL) {
Mutex mutex(&gLock); ICULocaleService * newservice = new ICUNumberFormatService();
if (gService == NULL) { if (newservice) {
gService = new ICUNumberFormatService(); Mutex mutex(&gnLock);
if (gService == NULL) {
gService = newservice;
newservice = NULL;
}
}
if (newservice) {
delete newservice;
} }
} }
return gService; return gService;
@ -698,7 +705,7 @@ U_CFUNC UBool numfmt_cleanup(void) {
delete gService; delete gService;
gService = NULL; gService = NULL;
} }
umtx_destroy(&gLock); umtx_destroy(&gnLock);
return TRUE; return TRUE;
} }