Setting thread priority in winXP

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
in 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
case). I would like to be able to set the program’s thread priority to
time_critical (or whatever the highest priority would be) during the time-
critical portions of the program, and then return it to normal priority so the
user would be able to interact (via the mouse and keyboard) with the program.
I would greatly appreciate any help that anyone could provide. Thanks in
advance.

Chris Dickinson, Ph.D.
Dept. of Psychology
University of Delaware

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
in SDL,

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
case).

I guess that would work…

I would like to be able to set the program’s thread priority to
time_critical

… 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.

Stephane