MSDN Documentation

GetThreadPriority

Function Signature

int GetThreadPriority(
  HANDLE hThread
);

Description

Retrieves the priority class of the specified thread.

Parameters

hThread A handle to the thread whose priority class is to be retrieved. This handle must have the THREAD_QUERY_INFORMATION access right. For more information, see Thread Security and Access Rights.

Return Value

The return value is the priority class of the thread. The return value is one of the following possible values:
  • ABOVE_NORMAL_PRIORITY_CLASS
  • BELOW_NORMAL_PRIORITY_CLASS
  • HIGH_PRIORITY_CLASS
  • IDLE_PRIORITY_CLASS
  • NORMAL_PRIORITY_CLASS
  • REALTIME_PRIORITY_CLASS
If the function fails, the return value is 0. To get extended error information, call GetLastError.

Remarks

The priority class determines the range of relative priorities that can be assigned to a thread.

A thread's base priority is determined by the priority class of the process that created it and the priority value specified when the thread was created. The GetThreadPriority function returns the thread's current base priority level.

To set a thread's priority, use the SetThreadPriority function.

An application can obtain a handle to the current thread by calling the GetCurrentThread function.

Important

Using REALTIME_PRIORITY_CLASS can cause your system to become unstable or unresponsive. Applications that use this priority class should be carefully designed and tested.

Requirements

Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Header winbase.h (include windows.h)
Library Kernel32.lib
DLL Kernel32.dll

See Also

Process and Thread Functions

GetCurrentThread

GetThreadPriorityBoost

SetThreadPriority

SetThreadPriorityBoost

Thread Functions