_threadpriority

Sets the threads dispatch priority.

int _threadpriority (int handle, int value);

int threadpriority (int handle, int value);

Required Header
<process.h>

Return Value

-1 indicates an error, 0-255 is returned as the new priority that is in effect.

Parameters

handle

  The handle returned from _beginthread or 0 to specify the current thread.

value

  The signed value to add to the current priority.

Remarks

The _threadpriority function alters the dispatch priority of a thread or the main program. The primary threads (0) priority cannot be changed by another thread, the priority of a thread can only be changed by itself or the program/thread that created it. If a thread attempts to alter the priority of a sibling thread (or their child) an ABEND (12C) will occur. The O/S priority limit for the task may cause the new priority to be less than what is expected.

The value may be specified as zero to return the current priority of any thread. Because the parameters handle value allows 0 for the current thread, only the primary thread may request its own priority value using this method.

Process and Threads

See Also    _endthread, _beginthread, _syncthread, _threadstatus