RtSetThreadPriority

RtSetThreadPriority sets the priority value for the specified thread.

NOTE: For Windows applications linked with RTX64, RtSetThreadPriority has been deprecated and will be removed from RTAPI in a future release. For compatibility, a new call RtSetProxyThreadPriority has been defined. IntervalZero recommends that all references to RtSetThreadPriority in a Windows application be replaced with RtSetProxyThreadPriority if you want to control how a thread interacts with the Real-time Subsystem.

Syntax

BOOL RtSetThreadPriority(
    HANDLE hThread,
    int RtssPriority
);

Parameters

hThread

The thread whose priority value is to be set.

RtssPriority

RTSS Environment: A priority level from 0 to 127, where 127 identifies the highest priority thread.

Return Value

TRUE if the function succeeds, FALSE if the function fails

To get extended error information, call GetLastError.

Remarks

If RtSetThreadPriority is called for a thread that currently has ownership of any mutexes, an attempt to lower priority will be delayed until mutexes have been released. If the target thead is at a promoted priority that resulted from activation of a priority inversion protocol, the priority set by this call will be the native priority used at demotion time. Note that if RtSetThreadPriority is called to raise thread priority it will execute immediately, regardless of whether the thread owns any mutexes.

NOTE: We recommend you do not use RtSetThreadPriority in the Windows environment.

Requirements

Minimum Supported Version RTX64 2013
Header Rtapi.h
Library RtApi.lib (Windows), Rtx_Rtss.lib (RTSS)

See Also:

RtGetThreadPriority