RtSetThreadPriority

RtSetThreadPriority sets the priority value for the specified thread.

Syntax

BOOL RtSetThreadPriority(
    HANDLE hThread,
    int nPriority
);

Parameters

hThread

The thread whose priority value is to be set.

nPriority

RTSS Environment: A priority level from 0 to 127, where 127 identifies the highest priority thread.
Win32 Environment:
Win32 has only seven program-settable thread priorities in the real-time priority class. RtSetThreadPriority maps the 128 thread priorities into these seven priorities. The RTX Win32 library maintains the real-time thread priority and returns this value when RtGetThreadPriority() is called.

Return Values

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 all mutexes have been released. If the target thread 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.

See Thread Priorities in the Application Development Guide for details on the relationship between Win32 and RTSS thread priorities.

Requirements

Header Rtapi.h
Library Rtx_Rtss.lib

See Also:

GetThreadPriority

RtGetThreadPriority

SetThreadPriority

IntervalZero.com | Support | Give Feedback