• Home
  • Raw
  • Download

Lines Matching refs:m

94 #define PLATFORM_MUTEX_INIT(m)   argument
95 #define PLATFORM_MUTEX_LOCK(m) argument
96 #define PLATFORM_MUTEX_UNLOCK(m) argument
97 #define PLATFORM_MUTEX_DESTROY(m) argument
105 #define PLATFORM_MUTEX_INIT(m) InitializeCriticalSection(m) argument
106 #define PLATFORM_MUTEX_LOCK(m) EnterCriticalSection(m) argument
107 #define PLATFORM_MUTEX_UNLOCK(m) LeaveCriticalSection(m) argument
108 #define PLATFORM_MUTEX_DESTROY(m) DeleteCriticalSection(m) argument
115 #define PLATFORM_MUTEX_INIT(m) pthread_mutex_init(m, NULL) argument
116 #define PLATFORM_MUTEX_LOCK(m) pthread_mutex_lock(m) argument
117 #define PLATFORM_MUTEX_UNLOCK(m) pthread_mutex_unlock(m) argument
118 #define PLATFORM_MUTEX_DESTROY(m) pthread_mutex_destroy(m) argument
132 #define PLATFORM_MUTEX_INIT(m) argument
133 #define PLATFORM_MUTEX_LOCK(m) argument
134 #define PLATFORM_MUTEX_UNLOCK(m) argument
135 #define PLATFORM_MUTEX_DESTROY(m) argument
217 ICUMutex *m; in umtx_lock() local
222 m = (ICUMutex *)*mutex; in umtx_lock()
223 if (m == NULL) { in umtx_lock()
228 m = (ICUMutex *)*mutex; in umtx_lock()
230 U_ASSERT(m->owner == mutex); in umtx_lock()
233 (*pMutexLockFn)(gMutexContext, &m->userMutex); in umtx_lock()
235 PLATFORM_MUTEX_LOCK(&m->platformMutex); in umtx_lock()
239 m->recursionCount++; /* Recursion causes deadlock on Unixes. */ in umtx_lock()
240 U_ASSERT(m->recursionCount == 1); /* Recursion detection works on Windows. */ in umtx_lock()
254 ICUMutex *m; in umtx_unlock() local
258 m = (ICUMutex *)*mutex; in umtx_unlock()
259 if (m == NULL) { in umtx_unlock()
263 U_ASSERT(m->owner == mutex); in umtx_unlock()
266 m->recursionCount--; in umtx_unlock()
267 U_ASSERT(m->recursionCount == 0); /* Detect unlock of an already unlocked mutex */ in umtx_unlock()
271 (*pMutexUnlockFn)(gMutexContext, &m->userMutex); in umtx_unlock()
273 PLATFORM_MUTEX_UNLOCK(&m->platformMutex); in umtx_unlock()
281 static ICUMutex *umtx_ct(ICUMutex *m) { in umtx_ct() argument
282 if (m == NULL) { in umtx_ct()
283 m = (ICUMutex *)uprv_malloc(sizeof(ICUMutex)); in umtx_ct()
284 m->heapAllocated = TRUE; in umtx_ct()
286 m->next = NULL; /* List of mutexes is maintained at a higher level. */ in umtx_ct()
287 m->recursionCount = 0; in umtx_ct()
288 m->userMutex = NULL; in umtx_ct()
291 (*pMutexInitFn)(gMutexContext, &m->userMutex, &status); in umtx_ct()
294 PLATFORM_MUTEX_INIT(&m->platformMutex); in umtx_ct()
296 return m; in umtx_ct()
303 static void umtx_dt(ICUMutex *m) { in umtx_dt() argument
305 (*pMutexDestroyFn)(gMutexContext, &m->userMutex); in umtx_dt()
306 m->userMutex = NULL; in umtx_dt()
308 PLATFORM_MUTEX_DESTROY(&m->platformMutex); in umtx_dt()
311 if (m->heapAllocated) { in umtx_dt()
312 uprv_free(m); in umtx_dt()
319 ICUMutex *m = NULL; in umtx_init() local
330 m = &globalMutex; in umtx_init()
334 m = umtx_ct(m); in umtx_init()
335 originalValue = SYNC_COMPARE_AND_SWAP(mutex, NULL, m); in umtx_init()
337 umtx_dt(m); in umtx_init()
341 m->owner = mutex; in umtx_init()
348 m->next = mutexListHead; in umtx_init()
349 mutexListHead = m; in umtx_init()
364 ICUMutex *m; in umtx_destroy() local
374 m = (ICUMutex *)*mutex; in umtx_destroy()
375 if (m == NULL) { /* Mutex not initialized, or already destroyed. */ in umtx_destroy()
379 U_ASSERT(m->owner == mutex); in umtx_destroy()
380 if (m->owner != mutex) { in umtx_destroy()
386 if (mutexListHead == m) { in umtx_destroy()
387 mutexListHead = m->next; in umtx_destroy()
390 for (prev = mutexListHead; prev!=NULL && prev->next!=m; prev = prev->next); in umtx_destroy()
393 prev->next = m->next; in umtx_destroy()
398 umtx_dt(m); /* Delete the internal ICUMutex */ in umtx_destroy()