diff --git a/src/thread/windows/SDL_syssem.c b/src/thread/windows/SDL_syssem.c index 45497fc4a..753d42942 100644 --- a/src/thread/windows/SDL_syssem.c +++ b/src/thread/windows/SDL_syssem.c @@ -66,6 +66,16 @@ static SDL_sem_impl_t SDL_sem_impl_active = {0}; * Atomic + WaitOnAddress implementation */ +/* APIs not available on WinPhone 8.1 */ +/* https://www.microsoft.com/en-us/download/details.aspx?id=47328 */ + +#if (HAVE_WINAPIFAMILY_H) && defined(WINAPI_FAMILY_PHONE_APP) +#define SDL_WINAPI_FAMILY_PHONE (WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP) +#else +#define SDL_WINAPI_FAMILY_PHONE 0 +#endif + +#if !SDL_WINAPI_FAMILY_PHONE #if __WINRT__ /* Functions are guaranteed to be available */ #define pWaitOnAddress WaitOnAddress @@ -241,6 +251,7 @@ static const SDL_sem_impl_t SDL_sem_impl_atom = &SDL_SemValue_atom, &SDL_SemPost_atom, }; +#endif /* !SDL_WINAPI_FAMILY_PHONE */ /** @@ -392,6 +403,7 @@ SDL_CreateSemaphore(Uint32 initial_value) /* Default to fallback implementation */ const SDL_sem_impl_t * impl = &SDL_sem_impl_kern; +#if !SDL_WINAPI_FAMILY_PHONE if (!SDL_GetHintBoolean(SDL_HINT_WINDOWS_FORCE_SEMAPHORE_KERNEL, SDL_FALSE)) { #if __WINRT__ /* Link statically on this platform */ @@ -415,6 +427,7 @@ SDL_CreateSemaphore(Uint32 initial_value) } #endif } +#endif /* Copy instead of using pointer to save one level of indirection */ SDL_memcpy(&SDL_sem_impl_active, impl, sizeof(SDL_sem_impl_active));