[#BloombergLP-bslmt-ThreadAttributes] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslmt.adoc[bslmt]::ThreadAttributes :relfileprefix: ../../ :mrdocs: 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>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- 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 [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslmt/ThreadAttributes/_04enum.adoc[`Unnamed enum`] | Default attribute value constants. | xref:BloombergLP/bslmt/ThreadAttributes/DetachedState-09.adoc[`DetachedState`] | This enumeration provides two values used to distinguish among a joinable thread and a non‐joinable (detached) thread. | xref:BloombergLP/bslmt/ThreadAttributes/SchedulingPolicy-08.adoc[`SchedulingPolicy`] | Thread scheduling policies. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslmt/ThreadAttributes/2constructor-09.adoc[`ThreadAttributes`] [.small]#[constructor]# | Constructors | xref:BloombergLP/bslmt/ThreadAttributes/operator_assign.adoc[`operator=`] | Assign to this object the value of the specified `rhs` object, and return a reference providing modifiable access to this object. | xref:BloombergLP/bslmt/ThreadAttributes/allocator.adoc[`allocator`] | Return the allocator used by this object to supply memory. | xref:BloombergLP/bslmt/ThreadAttributes/detachedState-05.adoc[`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. | xref:BloombergLP/bslmt/ThreadAttributes/guardSize.adoc[`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. | xref:BloombergLP/bslmt/ThreadAttributes/inheritSchedule.adoc[`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. | xref:BloombergLP/bslmt/ThreadAttributes/print.adoc[`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. | xref:BloombergLP/bslmt/ThreadAttributes/schedulingPolicy-01.adoc[`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. | xref:BloombergLP/bslmt/ThreadAttributes/schedulingPriority.adoc[`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. | xref:BloombergLP/bslmt/ThreadAttributes/setDetachedState.adoc[`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. | xref:BloombergLP/bslmt/ThreadAttributes/setGuardSize.adoc[`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`. | xref:BloombergLP/bslmt/ThreadAttributes/setInheritSchedule.adoc[`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. | xref:BloombergLP/bslmt/ThreadAttributes/setSchedulingPolicy.adoc[`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. | xref:BloombergLP/bslmt/ThreadAttributes/setSchedulingPriority.adoc[`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. | xref:BloombergLP/bslmt/ThreadAttributes/setStackSize.adoc[`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`. | xref:BloombergLP/bslmt/ThreadAttributes/setThreadName.adoc[`setThreadName`] | Set the `threadName` attribute of this object to the specified `value`. Return a non‐`const` reference to this object (see also {Fluent Interface}). | xref:BloombergLP/bslmt/ThreadAttributes/stackSize.adoc[`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`. | xref:BloombergLP/bslmt/ThreadAttributes/threadName.adoc[`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. | xref:BloombergLP/bslmt/ThreadAttributes/2conversion.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration<ThreadAttributes, UsesBslmaAllocator>`] | Declare that this type uses a `bslma` allocator. |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslmt/operator_not_eq.adoc[`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. | xref:BloombergLP/bslmt/operator_eq.adoc[`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. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#