+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/************************************************************************
* Copyright (C) 1996-2014, International Business Machines Corporation
* and others. All Rights Reserved.
return(uprv_isNaN(d));
}
-static UMutex ccLock = U_MUTEX_INITIALIZER;
+static icu::UMutex *ccLock() {
+ static icu::UMutex *m = STATIC_NEW(icu::UMutex);
+ return m;
+}
U_CDECL_BEGIN
static UBool calendar_astro_cleanup(void) {
if(U_FAILURE(status)) {
return 0;
}
- umtx_lock(&ccLock);
+ umtx_lock(ccLock());
if(*cache == NULL) {
createCache(cache, status);
if(U_FAILURE(status)) {
- umtx_unlock(&ccLock);
+ umtx_unlock(ccLock());
return 0;
}
}
res = uhash_igeti((*cache)->fTable, key);
U_DEBUG_ASTRO_MSG(("%p: GET: [%d] == %d\n", (*cache)->fTable, key, res));
- umtx_unlock(&ccLock);
+ umtx_unlock(ccLock());
return res;
}
if(U_FAILURE(status)) {
return;
}
- umtx_lock(&ccLock);
+ umtx_lock(ccLock());
if(*cache == NULL) {
createCache(cache, status);
if(U_FAILURE(status)) {
- umtx_unlock(&ccLock);
+ umtx_unlock(ccLock());
return;
}
}
uhash_iputi((*cache)->fTable, key, value, &status);
U_DEBUG_ASTRO_MSG(("%p: PUT: [%d] := %d\n", (*cache)->fTable, key, value));
- umtx_unlock(&ccLock);
+ umtx_unlock(ccLock());
}
CalendarCache::CalendarCache(int32_t size, UErrorCode &status) {