29 #ifndef AVCODEC_W32PTHREADS_H
30 #define AVCODEC_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;
90 DWORD ret = WaitForSingleObject(thread.
handle, INFINITE);
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;
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);
251 WaitForSingleObject(win32_cond->
waiters_done, INFINITE);
260 HANDLE kernel_dll = GetModuleHandle(TEXT(
"kernel32.dll"));
263 (
void*)GetProcAddress(kernel_dll,
"InitializeConditionVariable");
265 (
void*)GetProcAddress(kernel_dll,
"WakeAllConditionVariable");
267 (
void*)GetProcAddress(kernel_dll,
"WakeConditionVariable");
269 (
void*)GetProcAddress(kernel_dll,
"SleepConditionVariableCS");