29 #ifndef FFMPEG_COMPAT_W32PTHREADS_H
30 #define FFMPEG_COMPAT_W32PTHREADS_H
38 #define WIN32_LEAN_AND_MEAN
48 void *(*func)(
void*
arg);
65 #if _WIN32_WINNT < 0x0600
72 #define cond_init InitializeConditionVariable
73 #define cond_broadcast WakeAllConditionVariable
74 #define cond_signal WakeConditionVariable
75 #define cond_wait SleepConditionVariableCS
86 void *(*start_routine)(
void*),
void *
arg)
88 thread->
func = start_routine;
98 if (ret != WAIT_OBJECT_0)
101 *value_ptr = thread.
ret;
102 CloseHandle(thread.
handle);
107 InitializeCriticalSection(m);
112 DeleteCriticalSection(m);
117 EnterCriticalSection(m);
122 LeaveCriticalSection(m);
149 cond->
ptr = win32_cond;
150 win32_cond->
semaphore = CreateSemaphore(NULL, 0, 0x7fffffff, NULL);
183 if (cond_broadcast) {
184 cond_broadcast(cond);
201 WaitForSingleObject(win32_cond->
waiters_done, INFINITE);
214 cond_wait(cond, mutex, INFINITE);
227 WaitForSingleObject(win32_cond->
semaphore, INFINITE);
258 ReleaseSemaphore(win32_cond->
semaphore, 1, NULL);
259 WaitForSingleObject(win32_cond->
waiters_done, INFINITE);
268 #if _WIN32_WINNT < 0x0600
269 HANDLE kernel_dll = GetModuleHandle(TEXT(
"kernel32.dll"));