- static ConditionArg g_InitializeConditionVariable;
- static ConditionArg g_WakeConditionVariable;
- static ConditionArg g_WakeAllConditionVariable;
- static ConditionMutexArg g_SleepConditionVariableCS;
-
- // check whether vista+ conditions are available at runtime
- static bool CheckVistaConditionFunctions(void)
- {
- static int iHasVistaConditionFunctions(-1);
- if (iHasVistaConditionFunctions == -1)
- {
- HMODULE handle = GetModuleHandle("Kernel32");
- if (handle == NULL)
- {
- iHasVistaConditionFunctions = 0;
- }
- else
- {
- g_InitializeConditionVariable = (ConditionArg) GetProcAddress(handle,"InitializeConditionVariable");
- g_WakeConditionVariable = (ConditionArg) GetProcAddress(handle,"WakeConditionVariable");
- g_WakeAllConditionVariable = (ConditionArg) GetProcAddress(handle,"WakeAllConditionVariable");
- g_SleepConditionVariableCS = (ConditionMutexArg)GetProcAddress(handle,"SleepConditionVariableCS");
-
- // 1 when everything is resolved, 0 otherwise
- iHasVistaConditionFunctions = g_InitializeConditionVariable &&
- g_WakeConditionVariable &&
- g_WakeAllConditionVariable &&
- g_SleepConditionVariableCS ? 1 : 0;
- }
- }
- return iHasVistaConditionFunctions == 1;
- }