Home | History | Annotate | Download | only in common

Lines Matching refs:mutex

17 *   11/22/99    aliu        Make non-global mutex autoinitialize [j151]
26 * ICU Mutex wrappers. Wrap operating system mutexes, giving the rest of ICU a
27 * platform independent set of mutex operations. For internal ICU use only.
70 // Unknown platform. Note that user can still set mutex functions at run time.
77 // The ICU global mutex. Used when ICU implementation code passes NULL for the mutex pointer.
80 // Implementation mutex. Used for compare & swap when no intrinsic is available, and
99 * User mutex implementation functions. If non-null, call back to these rather than
133 * User mutex lock.
135 * User mutexes need to be initialized before they can be used. We use the impl mutex
140 static void usrMutexLock(UMutex *mutex) {
142 if (!(mutex == &implMutex || mutex == &globalMutex)) {
144 if (!mutex->fInitialized) {
145 (*pMutexInitFn)(gMutexContext, &mutex->fUserMutex, &status);
147 mutex->fInitialized = TRUE;
150 gMutexList[gMutexListSize] = mutex;
156 (*pMutexLockFn)(gMutexContext, &mutex->fUserMutex);
168 // There is no runtime mutex initialization code needed.
171 umtx_lock(UMutex *mutex) {
172 if (mutex == NULL) {
173 mutex = &globalMutex;
176 usrMutexLock(mutex);
180 int sysErr = pthread_mutex_lock(&mutex->fMutex);
183 pthread_mutex_lock(&mutex->fMutex);
190 umtx_unlock(UMutex* mutex)
192 if (mutex == NULL) {
193 mutex = &globalMutex;
196 (*pMutexUnlockFn)(gMutexContext, &mutex->fUserMutex);
200 int sysErr = pthread_mutex_unlock(&mutex->fMutex);
203 pthread_mutex_unlock(&mutex->fMutex);
266 UMutex *mutex = static_cast<UMutex *>(param);
267 U_ASSERT(sizeof(CRITICAL_SECTION) <= sizeof(mutex->fCS));
268 InitializeCriticalSection((CRITICAL_SECTION *)mutex->fCS);
276 umtx_lock(UMutex *mutex) {
277 if (mutex == NULL) {
278 mutex = &globalMutex;
281 usrMutexLock(mutex);
283 u_InitOnceExecuteOnce(&mutex->fInitOnce, winMutexInit, mutex, NULL);
284 EnterCriticalSection((CRITICAL_SECTION *)mutex->fCS);
289 umtx_unlock(UMutex* mutex)
291 if (mutex == NULL) {
292 mutex = &globalMutex;
295 (*pMutexUnlockFn)(gMutexContext, &mutex->fUserMutex);
297 LeaveCriticalSection((CRITICAL_SECTION *)mutex->fCS);
311 /* Can not set a mutex function to a NULL value */
323 // Clean up any previously set user mutex functions.
331 /* Swap in the mutex function pointers. */
439 /* Can not set a mutex function to a NULL value */
467 * Mutex Cleanup Function
468 * Reset the mutex function callback pointers.