Threads Module User's Guide : PART II Concurrency Packages : Chapter 3 The Threading Package : Thread Attributes : Determining the Legal Range For An Attribute
Determining the Legal Range For An Attribute
To determine the current limits for the priority, stack size, and time-slice quantum attributes, use the following RWThreadAttribute member functions:
getMinStackSize() — This static function returns the bare-minimum stack size required by a thread that calls a null function. The Threading package automatically guarantees that the size of any stack allocated by the system is greater than this size.
Use this function when creating a user-defined stack. This function can only be called if the RW_THR_HAS_STACK_RESERVE_SIZE or RW_THR_HAS_USER_STACK macros are defined. If those macros have not been defined, an RWTHROperationNotSupported exception is produced.
getMinPriority() — Returns the minimum priority value supported by the current contention scope and scheduling policy. This function can only be called if RW_THR_HAS_PRIORITY is defined. If it is not defined, an RWTHROperationNotSupported exception is produced.
getMaxPriority() — Returns the maximum priority value supported by the current contention scope and scheduling policy. This function can only be called if RW_THR_HAS_PRIORITY is defined. If it is not defined, an RWTHROperationNotSupported exception is produced.
getMinProcessScopePriority() — Returns the minimum priority value supported by process-scope threads under the current scheduling policy. This function can only be called when the contention scope value is RW_THR_PROCESS_SCOPE, or when the contention scope is RW_THR_SYSTEM_SCOPE and the current environment uses dual-priorities as indicated by the definition of the RW_THR_HAS_DUAL_PRIORITY macro. If those restrictions are not met, an RWTHROperationNotAvailable exception is thrown. In addition, this function can only be called if RW_THR_HAS_PRIORITY is defined. If it is not defined, an RWTHROperationNotSupported exception is produced.
getMaxProcessScopePriority() — Returns the maximum priority value supported by process-scope threads under the current scheduling policy. This function can only be called when the contention scope value is RW_THR_PROCESS_SCOPE, or when the contention scope is RW_THR_SYSTEM_SCOPE and the current environment uses dual-priorities as indicated by the definition of the RW_THR_HAS_DUAL_PRIORITY macro. If those restrictions are not met, an RWTHROperationNotAvailable exception is thrown. In addition, this function can only be called if RW_THR_HAS_PRIORITY is defined. If it is not defined, an RWTHROperationNotSupported exception is produced.
getMinSystemScopePriority() — Returns the minimum priority value supported by system-scope threads under the current scheduling policy. This function can only be called when the contention scope value is RW_THR_SYSTEM_SCOPE. If the value is not RW_THR_SYSTEM_SCOPE, an RWTHROperationNotAvailable exception is thrown. In addition, this function can only be called if RW_THR_HAS_PRIORITY is defined. If it is not define, an RWTHROperationNotSupported exception is produced.
getMaxSystemScopePriority() — Returns the maximum priority value supported by system-scope threads under the current scheduling policy. This function can only be called when the contention scope value is RW_THR_SYSTEM_SCOPE. If the value is not RW_THR_SYSTEM_SCOPE, an RWTHROperationNotAvailable exception is thrown. In addition, this function can only be called if RW_THR_HAS_PRIORITY is defined. If it is not defined, an RWTHROperationNotSupported exception is produced.
getMinTimeSliceQuantum() — Returns the minimum time-slice quantum value supported under the current scheduling policy. This function can only be called when the environment and scheduling policy support a time-slice quantum attribute. If the current policy does not give access to the time-slice quantum, an RWTHROperationNotAvailable exception is thrown. In addition, this function can only be called if RW_THR_HAS_TIME_SLICE_QUANTUM is defined. If it is not defined, an RWTHROperationNotSupported exception is produced.
getMaxTimeSliceQuantum() — Returns the maximum time-slice quantum value supported under the current scheduling policy. This function can only be called when the environment and scheduling policy support a time-slice quantum attribute. If the current policy does not give access to the time-slice quantum, an RWTHROperationNotAvailable exception is thrown. In addition, this function can only be called if RW_THR_HAS_TIME_SLICE_QUANTUM is defined. If it is not defined, an RWTHROperationNotSupported exception is produced.
Once a thread has been created and is active, you can use a similar set of functions included in the RWThread and RWThreadSelf classes.
getMinPriority()
getMaxPriority()
getMinProcessScopePriority()
getMaxProcessScopePriority()
getMinSystemScopePriority()
getMaxSystemScopePriority()
getMinTimeSliceQuantum()
getMaxTimeSliceQuantum()
In addition to throwing the same exceptions as their RWThreadAttribute counterparts, these functions might also produce an RWTHRThreadNotActive exception if you attempt to query the current limits on a threaded runnable that does not possess an active thread.