diff options
author | Sam Lantinga <slouken@libsdl.org> | 2011-03-25 10:47:49 -0700 |
---|---|---|
committer | Sam Lantinga <slouken@libsdl.org> | 2011-03-25 10:47:49 -0700 |
commit | bca33709c69595d9f6dc8ecc40e1f122759552ac (patch) | |
tree | 08d237b58092ba1563a399bd43450d42b4e22884 /src/thread/windows | |
parent | 0b1225e30161807221d4758225000bbf3c346daa (diff) |
Implemented SDL_SetThreadPriority()
Diffstat (limited to 'src/thread/windows')
-rw-r--r-- | src/thread/windows/SDL_systhread.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/thread/windows/SDL_systhread.c b/src/thread/windows/SDL_systhread.c index dbd8dc0f..058ff93f 100644 --- a/src/thread/windows/SDL_systhread.c +++ b/src/thread/windows/SDL_systhread.c @@ -155,6 +155,25 @@ SDL_ThreadID(void) return ((SDL_threadID) GetCurrentThreadId()); } +int +SDL_SYS_SetThreadPriority(SDL_Thread * thread, SDL_ThreadPriority priority) +{ + BOOL result; + + if (priority == SDL_THREAD_PRIORITY_LOW) { + result = SetThreadPriority(thread->handle, THREAD_PRIORITY_LOWEST); + } else if (priority == SDL_THREAD_PRIORITY_HIGH) { + result = SetThreadPriority(thread->handle, THREAD_PRIORITY_HIGHEST); + } else { + result = SetThreadPriority(thread->handle, THREAD_PRIORITY_NORMAL); + } + if (!result) { + WIN_SetError("SetThreadPriority()"); + return -1; + } + return 0; +} + void SDL_SYS_WaitThread(SDL_Thread * thread) { |