ThreadSetPriority — Set the Dispatching Priority of Threads

ThreadSetPriority
retcode
reascode
thread_ID
priority
flags

Purpose

Use the ThreadSetPriority function to set the dispatching priority of a specified thread or all threads other than the calling thread in the current process.

Parameters

retcode
(output,INT,4) is a variable where the function stores the return code.
reascode
(output,INT,4) is a variable where the function stores the reason code.
thread_ID
(input,INT,4) is a variable for specifying the thread whose priority should be adjusted, as follows:
-1
All threads in the caller's process except the calling thread
0
The calling thread
n>0
Thread n in the caller's process
priority
(input,INT,4) is a variable for specifying the absolute priority or relative priority of the specified thread. The relative priority is the offset that should be added to the current priority to determine the new priority.
flags
(input,INT,4) is a variable for specifying whether priority is to be treated as an absolute or relative value, as follows:
vm_pro_absolute_priority
priority is absolute
vm_pro_relative_priority
priority is relative

Usage Notes

  1. To decrease a thread's priority, use a negative priority. To increase it, use a positive value.
  2. The value passed in priority must result in a thread priority in the range of 0 to 32767. If thread_ID is -1 and this condition is encountered, the priorities of some threads may not be adjusted.

Return Codes and Reason Codes

Return Code Reason Code Meaning
vm_pro_success vm_pro_success ThreadSetPriority completed successfully
vm_pro_error vm_pro_no_such_thread No thread in the caller's process has ID thread_ID
vm_pro_error vm_pro_bad_priority Priority resulted in an out-of-range thread priority
vm_pro_error vm_pro_bad_flags Flags contains an invalid value

Programming Language Bindings

Language Language Binding File
C VMCPRO H
Assembler VMASMPRO MACRO
REXX VMREXPRO COPY