CWinThread::SetThreadPriority
This method sets the priority level of the current thread within its priority class.
It can only be called after CreateThread successfully returns.
BOOL SetThreadPriority(
int nPriority );
Parameters
- nPriority
Specifies the new thread priority level within its priority class. This parameter must be one of the following values, listed from highest priority to lowest:- THREAD_PRIORITY_TIME_CRITICAL
- THREAD_PRIORITY_HIGHEST
- THREAD_PRIORITY_ABOVE_NORMAL
- THREAD_PRIORITY_NORMAL
- THREAD_PRIORITY_BELOW_NORMAL
- THREAD_PRIORITY_LOWEST
- THREAD_PRIORITY_IDLE
Return Value
Nonzero if function was successful; otherwise, it is zero.
Remarks
Windows CE does not support priority classes. The order in which threads are scheduled is determined only by their thread priorities. A thread can have one of the priority levels shown in the following table.
Priority | Description |
---|---|
THREAD_PRIORITY_TIME_CRITICAL | 3 points above normal priority. |
THREAD_PRIORITY_HIGHEST | 2 points above normal priority. |
THREAD_PRIORITY_ABOVE_NORMAL | 1 point above normal priority. |
THREAD_PRIORITY_NORMAL | Normal priority. |
THREAD_PRIORITY_BELOW_NORMAL | 1 point below normal priority. |
THREAD_PRIORITY_LOWEST | 2 points below normal priority. |
THREAD_PRIORITY_ABOVE_IDLE | 3 points below normal priority. |
THREAD_PRIORITY_IDLE | 4 points below normal priority. |
In Windows CE, a thread with a priority level of THREAD_PRIORITY_TIME_CRITICAL will execute until it explicitly yields processing to other threads. Processing of these threads is not yielded to other threads, even if another thread also has the THREAD_PRIORITY_TIME_CRITICAL priority level.
Requirements
** Windows CE versions:** 1.0 and later
Header file: Declared in Afxwin.h
Platform: H/PC Pro, Palm-size PC, Pocket PC