mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-01 23:48:29 +00:00
WinRT: bug-fix - SDL_SetThreadPriority() didn't work on WinRT 8.x platforms
WinRT 8.0 (Phone and non-Phone) didn't offer an API to set an already-created thread's priority. WinRT 8.1 offered this API, along with several other Win32 thread functions that were previously unavailable (in WinRT). This change makes WinRT 8.1+ platforms use SDL's Win32 backend.
This commit is contained in:
@@ -45,7 +45,11 @@ SDL_CreateSemaphore(Uint32 initial_value)
|
||||
sem = (SDL_sem *) SDL_malloc(sizeof(*sem));
|
||||
if (sem) {
|
||||
/* Create the semaphore, with max value 32K */
|
||||
#if __WINRT__
|
||||
sem->id = CreateSemaphoreEx(NULL, initial_value, 32 * 1024, NULL, 0, SEMAPHORE_ALL_ACCESS);
|
||||
#else
|
||||
sem->id = CreateSemaphore(NULL, initial_value, 32 * 1024, NULL);
|
||||
#endif
|
||||
sem->count = initial_value;
|
||||
if (!sem->id) {
|
||||
SDL_SetError("Couldn't create semaphore");
|
||||
@@ -86,7 +90,11 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
|
||||
} else {
|
||||
dwMilliseconds = (DWORD) timeout;
|
||||
}
|
||||
#if __WINRT__
|
||||
switch (WaitForSingleObjectEx(sem->id, dwMilliseconds, FALSE)) {
|
||||
#else
|
||||
switch (WaitForSingleObject(sem->id, dwMilliseconds)) {
|
||||
#endif
|
||||
case WAIT_OBJECT_0:
|
||||
InterlockedDecrement(&sem->count);
|
||||
retval = 0;
|
||||
|
Reference in New Issue
Block a user