BloombergLP::bslmt::ThreadAttributes

This simply constrained (value-semantic) attribute class characterizes a collection of thread attribute values. See the section for information on the class attributes.

Synopsis

Declared in <bslmt_threadattributes.h>

class ThreadAttributes;

Description

This class: * supports a complete set of value semantic operations

  • except for bdex serialization * is exception-neutral * is alias-safe * is const thread-safe For terminology see bsldoc_glossary.

Enums

NameDescription
Unnamed enum Default attribute value constants.
DetachedState This enumeration provides two values used to distinguish among a joinable thread and a non-joinable (detached) thread.
SchedulingPolicy Thread scheduling policies.

Member Functions

NameDescription
ThreadAttributes [constructor]Constructors
operator= Assign to this object the value of the specified rhs object, and return a reference providing modifiable access to this object.
allocator Return the allocator used by this object to supply memory.
detachedState Return the value of the detachedState attribute of this object. A value of e_CREATE_JOINABLE indicates that a thread must be joined after it terminates to clean up its resources; a value of e_CREATE_DETACHED (the only other legal value) indicates that the resources will be cleaned up automatically upon thread termination, and that the thread must not be joined.
guardSize Return the value of the guardSize attribute of this object. The value e_UNSET_GUARD_SIZE == guardSize is intended to indicate that the default value as defined by the platform (which is typically the size of one or two pages) should be obtained from bslmt_configuration and used.
inheritSchedule Return the value of the inheritSchedule attribute of this object. A value of false for the inherit schedule attribute indicates that a thread should not inherit the scheduling policy and priority of the thread that created it and instead should use the respective values supplied by this object; whereas a value of true indicates that the thread should inherit these attributes and ignore the respective values in this object. See bslmt_threadutil for information about support for this attribute.
print Format this object to the specified output stream at the (absolute value of) the optionally specified indentation level and return a reference to stream. If level is specified, optionally specify spacesPerLevel, the number of spaces per indentation level for this and all of its nested objects. If level is negative, suppress indentation of the first line. If spacesPerLevel is negative format the entire output on one line, suppressing all but the initial indentation (as governed by level). If stream is not valid on entry, this operation has no effect.
schedulingPolicy Return the value of the schedulingPolicy attribute of this object. This attribute is ignored unless inheritSchedule is false. See bslmt_threadutil for information about this attribute.
schedulingPriority Return the value of the schedulingPriority attribute of this object. This attribute is ignored unless inheritSchedule() is false. Higher values of value signify more urgent priorities. Note that the valid range of priorities depends upon the platform and schedulingPolicy attribute, and the minimum and maximum priority values are determined by methods in bslmt_threadutil. See bslmt_threadutil for information about this attribute.
setDetachedState Set the detachedState attribute of this object to the specified value. Return a non-const reference to this object (see also {Fluent Interface}). A value of e_CREATE_JOINABLE (the default) indicates that a thread must be joined to clean up its resources after it terminates; a value of e_CREATE_DETACHED (the only other legal value) indicates that the resources will be cleaned up automatically upon thread termination, and that the thread must not be joined.
setGuardSize Set the guardSize attribute of this object to the specified value (in bytes). Return a non-const reference to this object (see also {Fluent Interface}). e_UNSET_GUARD_SIZE == guardSize is intended to indicate that the default value as defined by the platform is to be used. This default value is typically the size of one or two pages (see bslmt_configuration). The behavior is undefined unless e_UNSET_GUARD_SIZE == guardSize or guardSize >= 0.
setInheritSchedule Set the inheritSchedule attribute of this object to the specified value. Return a non-const reference to this object (see also {Fluent Interface}). A value of false for the inherit schedule attribute indicates that a thread should not inherit the scheduling policy and priority of the thread that created it and instead should use the respective values supplied by this object; whereas a value of true indicates that the thread should inherit these attributes and ignore the respective values in this object. See bslmt_threadutil for information about support for this attribute.
setSchedulingPolicy Set the value of the schedulingPolicy attribute of this object to the specified value. Return a non-const reference to this object (see also {Fluent Interface}). This attribute is ignored unless inheritSchedule is false. See bslmt_threadutil for information about this attribute.
setSchedulingPriority Set the schedulingPriority attribute of this object to the specified value. Return a non-const reference to this object (see also {Fluent Interface}). This attribute is ignored unless inheritSchedule() is false. Higher values of value signify more urgent priorities. Note that the valid range of priorities depends upon the platform and schedulingPolicy attribute, and the minimum and maximum priority values are determined by methods in bslmt_threadutil. See bslmt_threadutil for information about this attribute.
setStackSize Set the stackSize attribute of this object to the specified value. Return a non-const reference to this object (see also {Fluent Interface}). If stackSize is e_UNSET_STACK_SIZE, thread creation should use the default stack size value provided by bslmt_configuration. The behavior is undefined unless e_UNSET_STACK_SIZE == stackSize or 0 <= stackSize.
setThreadName Set the threadName attribute of this object to the specified value. Return a non-const reference to this object (see also {Fluent Interface}).
stackSize Return the value of the stackSize attribute of this object. If stackSize is e_UNSET_STACK_SIZE, thread creation should use the default stack size value provided by bslmt_configuration.
threadName Return the threadName attribute of this object. Note that the returned string reference will be invalidated if setThreadName is subsequently called on this object.
operator BloombergLP::bslmf::NestedTraitDeclaration<ThreadAttributes, UsesBslmaAllocator> Declare that this type uses a bslma allocator.

Non-Member Functions

NameDescription
operator!=Return true if the specified lhs and rhs objects do not have the same value, and false otherwise. Two baltzo::LocalTimeDescriptor objects do not have the same value if the corresponding values of their detachedState, guardSize, inheritSchedule, schedulingPolicy, schedulingPriority, and stackSize attributes are not the same.
operator==Return true if the specified lhs and rhs objects have the same value, and false otherwise. Two ThreadAttributes objects have the same value if the corresponding values of their detachedState, guardSize, inheritSchedule, schedulingPolicy, schedulingPriority, and stackSize attributes are the same.