Default Attribute Values
If you do not specify a value for an attribute, then the values are supplied by one of the following:
The Threading package.
The underlying API.
The creating thread or process.
For some attributes, you can query an
RWThreadAttribute instance for default attribute values by using the appropriate “get” function prior to setting the corresponding attribute. Before attempting to get the value, though, make sure that a default value is available by calling the appropriate “can get” function, as shown in
Example 24.
Example 24 – Querying for default thread attribute values
// Create new attribute instance with default values
RWThreadAttribute attribute;
RWSchedulingPolicy policy;
// Is there a default value available?
if (attribute.canGetSchedulingPolicy()) {
// Yes, query for the default value.
policy = attribute.getSchedulingPolicy();
.
.
.
}
The default values for some attributes might change in response to changes in other attribute values. For example, the range of legal priority values often varies according to the scheduling policy attribute value.
The default values for many of the attributes vary from environment to environment. You can find a description of the default values for attributes in the Threads Module Platform Guide.