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*
getService(void)
{
if (gService == NULL) {
Mutex mutex(&gLock);
ICULocaleService * newservice = new ICUNumberFormatService();
if (newservice) {
Mutex mutex(&gnLock);
if (gService == NULL) {
gService = new ICUNumberFormatService();
gService = newservice;
newservice = NULL;
}
}
if (newservice) {
delete newservice;
}
}
return gService;
@ -698,7 +705,7 @@ U_CFUNC UBool numfmt_cleanup(void) {
delete gService;
gService = NULL;
}
umtx_destroy(&gLock);
umtx_destroy(&gnLock);
return TRUE;
}