X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/f3c0d7a59d99c2a94c6b8822291f0e42be3773c9..a01113dcd0f39d5da295ef82785beff9ed86fe38:/icuSources/i18n/astro.cpp diff --git a/icuSources/i18n/astro.cpp b/icuSources/i18n/astro.cpp index b8f5f6dc..61b1ae91 100644 --- a/icuSources/i18n/astro.cpp +++ b/icuSources/i18n/astro.cpp @@ -65,7 +65,10 @@ static inline UBool isINVALID(double d) { 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) { @@ -7184,12 +7187,12 @@ int32_t CalendarCache::get(CalendarCache** cache, int32_t key, UErrorCode &statu 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; } } @@ -7197,7 +7200,7 @@ int32_t CalendarCache::get(CalendarCache** cache, int32_t key, UErrorCode &statu 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; } @@ -7205,12 +7208,12 @@ void CalendarCache::put(CalendarCache** cache, int32_t key, int32_t value, UErro 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; } } @@ -7218,7 +7221,7 @@ void CalendarCache::put(CalendarCache** cache, int32_t key, int32_t value, UErro 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) {