28 static int quarkwinthread_initialized = 0;
31 return GetCurrentThreadId();
37 pt.
hThread = GetCurrentThread();
38 pt.
uThId = GetCurrentThreadId();
58 static int pthread_mutex_check_for_static_initialization(
pthread_mutex_t *mutex ) {
61 if ( quarkwinthread_initialized == 0 ) {
62 quarkwinthread_initialized = 1;
76 rv = WaitForSingleObject( *mutex, INFINITE );
95 rv = WaitForSingleObject( *mutex, 0 );
111 if (! ReleaseMutex( *mutex ))
118 CloseHandle( *mutex );
142 void *(*QUARK_realThStart)(
void *);
159 thread->
hThread = (HANDLE)_beginthreadex(
172 ResumeThread( thread->
hThread );
178 WaitForSingleObject( thread.
hThread, INFINITE );
184 InitializeCriticalSection( &cond->
cs );
185 cond->
hSem = CreateSemaphore( NULL,
189 cond->
hEvt = CreateEvent( NULL,
198 DeleteCriticalSection( &cond->
cs );
199 CloseHandle( cond->
hSem );
200 CloseHandle( cond->
hEvt );
210 EnterCriticalSection(&cond->
cs);
212 LeaveCriticalSection(&cond->
cs);
216 SignalObjectAndWait(*mutex, cond->
hSem, INFINITE,
FALSE);
219 EnterCriticalSection(&cond->
cs);
225 LeaveCriticalSection(&cond->
cs);
232 SignalObjectAndWait(cond->
hEvt, *mutex, INFINITE,
FALSE);
234 WaitForSingleObject(*mutex, INFINITE);
240 int more_waiters = 0;
243 EnterCriticalSection (&cond->
cs);
254 LeaveCriticalSection(&cond->
cs);
257 WaitForSingleObject(cond->
hEvt, INFINITE);
259 LeaveCriticalSection(&cond->
cs);
267 pthread_conclevel = level;