Lines Matching refs:primitives

254 #define mutex_held(X) (GetCurrentThreadId()==primitives.aHolder[X])
261 } primitives = { 0 }; variable
264 if( !primitives.isInit ){ in async_os_initialize()
265 primitives.aCond[0] = CreateEvent(NULL, TRUE, FALSE, 0); in async_os_initialize()
266 if( primitives.aCond[0]==NULL ){ in async_os_initialize()
269 InitializeCriticalSection(&primitives.aMutex[0]); in async_os_initialize()
270 InitializeCriticalSection(&primitives.aMutex[1]); in async_os_initialize()
271 InitializeCriticalSection(&primitives.aMutex[2]); in async_os_initialize()
272 primitives.isInit = 1; in async_os_initialize()
277 if( primitives.isInit ){ in async_os_shutdown()
278 DeleteCriticalSection(&primitives.aMutex[0]); in async_os_shutdown()
279 DeleteCriticalSection(&primitives.aMutex[1]); in async_os_shutdown()
280 DeleteCriticalSection(&primitives.aMutex[2]); in async_os_shutdown()
281 CloseHandle(primitives.aCond[0]); in async_os_shutdown()
282 primitives.isInit = 0; in async_os_shutdown()
292 EnterCriticalSection(&primitives.aMutex[eMutex]); in async_mutex_enter()
293 TESTONLY( primitives.aHolder[eMutex] = GetCurrentThreadId(); ) in async_mutex_enter()
298 TESTONLY( primitives.aHolder[eMutex] = 0; ) in async_mutex_leave()
299 LeaveCriticalSection(&primitives.aMutex[eMutex]); in async_mutex_leave()
302 ResetEvent(primitives.aCond[eCond]); in async_cond_wait()
304 WaitForSingleObject(primitives.aCond[eCond], INFINITE); in async_cond_wait()
309 SetEvent(primitives.aCond[eCond]); in async_cond_signal()
320 #define mutex_held(X) pthread_equal(primitives.aHolder[X], pthread_self())
329 } primitives = { variable
343 pthread_mutex_lock(&primitives.aMutex[eMutex]); in async_mutex_enter()
344 TESTONLY( primitives.aHolder[eMutex] = pthread_self(); ) in async_mutex_enter()
349 TESTONLY( primitives.aHolder[eMutex] = 0; ) in async_mutex_leave()
350 pthread_mutex_unlock(&primitives.aMutex[eMutex]); in async_mutex_leave()
355 TESTONLY( primitives.aHolder[eMutex] = 0; ) in async_cond_wait()
356 pthread_cond_wait(&primitives.aCond[eCond], &primitives.aMutex[eMutex]); in async_cond_wait()
357 TESTONLY( primitives.aHolder[eMutex] = pthread_self(); ) in async_cond_wait()
361 pthread_cond_signal(&primitives.aCond[eCond]); in async_cond_signal()