29 #ifndef LIBAV_W32PTHREADS_H
30 #define LIBAV_W32PTHREADS_H
38 #define WIN32_LEAN_AND_MEAN
48 void *(*func)(
void*
arg);
79 void *(*start_routine)(
void*),
void *
arg)
81 thread->
func = start_routine;
91 if (ret != WAIT_OBJECT_0)
94 *value_ptr = thread.
ret;
95 CloseHandle(thread.
handle);
100 InitializeCriticalSection(m);
105 DeleteCriticalSection(m);
110 EnterCriticalSection(m);
115 LeaveCriticalSection(m);
142 cond->
ptr = win32_cond;
143 win32_cond->
semaphore = CreateSemaphore(NULL, 0, 0x7fffffff, NULL);
175 if (cond_broadcast) {
176 cond_broadcast(cond);
193 WaitForSingleObject(win32_cond->
waiters_done, INFINITE);
206 cond_wait(cond, mutex, INFINITE);
219 WaitForSingleObject(win32_cond->
semaphore, INFINITE);
250 ReleaseSemaphore(win32_cond->
semaphore, 1, NULL);
251 WaitForSingleObject(win32_cond->
waiters_done, INFINITE);
260 #if _WIN32_WINNT < 0x0600
261 HANDLE kernel_dll = GetModuleHandle(TEXT(
"kernel32.dll"));
272 cond_init = InitializeConditionVariable;
273 cond_broadcast = WakeAllConditionVariable;
274 cond_signal = WakeConditionVariable;
275 cond_wait = SleepConditionVariableCS;