Scheduling Inheritance Policy
The inheritance policy attribute is used to indicate whether the scheduling policy, priority, and time-slice quantum attributes for a new thread should be inherited from the creating thread or whether they should be based on the values defined within the RWThreadAttribute instance.
The enumerated type, RWInheritancePolicy, defines these inheritance policies as:
*RW_THR_INHERIT — Specifies that the default scheduling policy, priority, and time-slice quantum attributes should be inherited from the creating thread, if each of those attribute values has been left unchanged or has been restored to the default value with a call to the appropriate “reset” function. This is the default inheritance policy.
*RW_THR_EXPLICIT — Specifies that the default scheduling policy, priority, and time-slice quantum attributes should not be inherited, but should be included in the thread attribute instance.
The RWThreadAttribute member functions that manipulate the inheritance policy attribute value include:
*canGetInheritancePolicy() — Indicates whether the inheritance policy attribute is supported in the current environment and whether getInheritancePolicy() can currently return a legal value. This function always returns true and is included for consistency.
*isInheritancePolicySet() — Indicates whether the inheritance policy attribute value is the value that was previously set by a call to setInheritancePolicy(RWInheritancePolicy).
*getInheritancePolicy() — Returns the default inheritance policy value if the attribute value has not yet been set. Otherwise, it returns the value specified in the last call to setInheritancePolicy(RWInheritancePolicy). The default inheritance policy is available under all circumstances and is defined as RW_THR_INHERIT.
*canSetInheritancePolicy() — Indicates whether the inheritance policy attribute and attribute value passed as an argument are supported in the current environment. This function always returns true for either of the inheritance policies and is included for consistency.
*setInheritancePolicy(RWInheritancePolicy) — Sets the inheritance policy attribute to the value passed as an argument. This function only throws an exception if the value passed is not one of the two legal values.
*resetInheritancePolicy() — Restores the inheritance policy attribute to its default value.
Follow these rules when using this attribute:
*If you should choose to set any one of the scheduling policy, priority, or time-slice attributes, the inheritance policy is forced to RW_THR_EXPLICIT.
*Setting the inheritance policy to RW_THR_INHERIT causes the Threading package to discard any previous settings for the scheduling policy, priority, and time-slice attribute.
*The Threading package does not allow you to mix inherited and explicitly-defined scheduling attributes by setting only those attributes that you do not wish inherit.
To determine the inheritance policy used to create an active thread:
1. Acquire a handle to the thread’s runnable instance.
2. Use the getActiveAttribute() member included by the handle class to retrieve a copy of the RWThreadAttribute instance that created the thread.
3. Use the getInheritancePolicy() member to query the attribute instance for the inheritance policy used at thread creation.