[SDL] setting thread priority in winXP
stephane.marchesin at wanadoo.fr
Mon Jul 18 03:44:58 PDT 2005
Chris Dickinson a écrit :
>I have a question (obviously). I use SDL to present displays in psychology
>experiments, and for some parts of the program, display time is critical (it
>is important to ensure that the display time is not being altered because the
>OS is doing something to add an additional delay to the display duration). I
>know that in Windows XP, the thread priority of the main program can be set to
>time_critical with the WinAPI function SetThreadPriority(), and the program's
>thread can be obtained with the WinAPI function GetCurrentThread(). I was
>wondering if there was a way to identify and then change a thread's priority
There is no way to do so with SDL.
> or alternately if it would be possible to use the aforementioned
>WinAPI functions from within SDL (I would guess that this would not be the
I guess that would work...
> I would like to be able to set the program's thread priority to
... but time_critical can cause resource drain to other threads, even
from the same process.
So be sure not to rely on another thread inside the critical portions of
your code. And keep in mind that even seemingly simple things like
events or sound can depend on another thread.
More information about the SDL