This function returns the priority value for the specified thread.
At a Glance
Header file: | Winbase.h |
Windows CE versions: | 1.0 and later |
Syntax
int GetThreadPriority( HANDLE hThread);
Parameters
hThread
Handle to the thread.
Return Values
The thread’s priority level indicates success. THREAD_PRIORITY_ERROR_RETURN indicates failure. To get extended error information, call GetLastError.
The thread’s priority level is one of the values described in the following list.
THREAD_PRIORITY_TIME_CRITICAL
Indicates 3 points above normal priority.
THREAD_PRIORITY_HIGHEST
Indicates 2 points above normal priority.
THREAD_PRIORITY_ABOVE_NORMAL
Indicates 1 point above normal priority.
THREAD_PRIORITY_NORMAL
Indicates normal priority.
THREAD_PRIORITY_BELOW_NORMAL
Indicates 1 point below normal priority.
THREAD_PRIORITY_LOWEST
Indicates 2 points below normal priority.
THREAD_PRIORITY_ABOVE_IDLE
Indicates 3 points below normal priority.
THREAD_PRIORITY_IDLE
Indicates 4 points below normal priority.
Remarks
Windows CE does not support priority classes. The order in which threads are scheduled is determined only by their thread priorities.
When manipulating priorities, ensure that a high-priority thread does not consume all of the available CPU time. A thread with a priority level of THREAD_PRIORITY_TIME_CRITICAL will execute until it explicitly yields processing to other threads.
If a THREAD_PRIORITY_TIME_CRITICAL priority level running no other THREAD_PRIORITY_TIME_CRITICAL priority level thread will run until the first thread yields. The system will still be able to service IRQs and ISRs but will not be able to schedule any ISTs.
Threads are scheduled in a round-robin fashion at each priority level, and only when there are no executable threads at a higher level will scheduling of threads at a lower level take place
See Also