X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/f3c0d7a59d99c2a94c6b8822291f0e42be3773c9..a01113dcd0f39d5da295ef82785beff9ed86fe38:/icuSources/common/servnotf.cpp diff --git a/icuSources/common/servnotf.cpp b/icuSources/common/servnotf.cpp index dc77c7b8..e7a7ca50 100644 --- a/icuSources/common/servnotf.cpp +++ b/icuSources/common/servnotf.cpp @@ -21,7 +21,10 @@ U_NAMESPACE_BEGIN EventListener::~EventListener() {} UOBJECT_DEFINE_RTTI_IMPLEMENTATION(EventListener) -static UMutex notifyLock = U_MUTEX_INITIALIZER; +static UMutex *notifyLock() { + static UMutex *m = STATIC_NEW(UMutex); + return m; +} ICUNotifier::ICUNotifier(void) : listeners(NULL) @@ -30,7 +33,7 @@ ICUNotifier::ICUNotifier(void) ICUNotifier::~ICUNotifier(void) { { - Mutex lmx(¬ifyLock); + Mutex lmx(notifyLock()); delete listeners; listeners = NULL; } @@ -47,7 +50,7 @@ ICUNotifier::addListener(const EventListener* l, UErrorCode& status) } if (acceptsListener(*l)) { - Mutex lmx(¬ifyLock); + Mutex lmx(notifyLock()); if (listeners == NULL) { listeners = new UVector(5, status); } else { @@ -80,7 +83,7 @@ ICUNotifier::removeListener(const EventListener *l, UErrorCode& status) } { - Mutex lmx(¬ifyLock); + Mutex lmx(notifyLock()); if (listeners != NULL) { // identity equality check for (int i = 0, e = listeners->size(); i < e; ++i) { @@ -103,7 +106,7 @@ void ICUNotifier::notifyChanged(void) { if (listeners != NULL) { - Mutex lmx(¬ifyLock); + Mutex lmx(notifyLock()); if (listeners != NULL) { for (int i = 0, e = listeners->size(); i < e; ++i) { EventListener* el = (EventListener*)listeners->elementAt(i);