Function SetThreadPriority

SetThreadPriority sets the priority of the given thread relative to a Base. The Base is the value RTKConfig.MainPriority, RTKConfig.DefaultPriority, or the current task's priority (the first non-zero value is used). The priority is changed as follows:

Parameter nPriority

Priority

THREAD_PRIORITY_IDLE

Base - 3

THREAD_PRIORITY_LOWEST

Base - 2

THREAD_PRIORITY_BELOW_NORMAL

Base - 1

THREAD_PRIORITY_NORMAL

Base

THREAD_PRIORITY_ABOVE_NORMAL

Base + 1

THREAD_PRIORITY_HIGHEST

Base + 2

THREAD_PRIORITY_TIME_CRITICAL

Base + 3

If the resulting priority is below RTK_MIN_PRIO, RTK_MIN_PRIO is used instead. If the resulting priority is above RTK_MAX_PRIO, RTK_MAX_PRIO is used instead.

RTKConfig.MainPriority defaults to 5. This makes the range of priorities 2 to 8 available to Win32 threads.