BDE 4.14.0 Production release
|
#include <bslmt_threadattributes.h>
Public Types | |
enum | DetachedState { e_CREATE_JOINABLE = 0 , e_CREATE_DETACHED = 1 , BCEMT_CREATE_JOINABLE = e_CREATE_JOINABLE , BCEMT_CREATE_DETACHED = e_CREATE_DETACHED , CREATE_JOINABLE = e_CREATE_JOINABLE , CREATE_DETACHED = e_CREATE_DETACHED } |
enum | SchedulingPolicy { e_SCHED_OTHER = 0 , e_SCHED_FIFO = 1 , e_SCHED_RR = 2 , e_SCHED_DEFAULT = 3 , BCEMT_SCHED_OTHER = e_SCHED_OTHER , BCEMT_SCHED_FIFO = e_SCHED_FIFO , BCEMT_SCHED_RR = e_SCHED_RR , BCEMT_SCHED_DEFAULT = e_SCHED_DEFAULT } |
enum | { e_UNSET_STACK_SIZE = -1 , e_UNSET_GUARD_SIZE = -1 , e_UNSET_PRIORITY = INT_MIN , e_SCHED_MIN = e_SCHED_OTHER , e_SCHED_MAX = e_SCHED_DEFAULT , BCEMT_UNSET_STACK_SIZE = e_UNSET_STACK_SIZE , BCEMT_UNSET_GUARD_SIZE = e_UNSET_GUARD_SIZE , BCEMT_UNSET_PRIORITY = e_UNSET_PRIORITY , BCEMT_SCHED_MIN = e_SCHED_MIN , BCEMT_SCHED_MAX = e_SCHED_MAX } |
This simply constrained (value-semantic) attribute class characterizes a collection of thread attribute values. See the Attributes section for information on the class attributes.
This class:
bdex
serializationconst
thread-safe For terminology see bsldoc_glossary .anonymous enum |
The following constants indicate that the stackSize
, guardSize
, and schedulingPriority
attributes, respectively, are unspecified and the thread creation routine is use platform-specific defaults. These attributes are initialized to these values when a thread attributes object is default constructed.
Enumerator | |
---|---|
e_UNSET_STACK_SIZE | |
e_UNSET_GUARD_SIZE | |
e_UNSET_PRIORITY | |
e_SCHED_MIN | |
e_SCHED_MAX | |
BCEMT_UNSET_STACK_SIZE | |
BCEMT_UNSET_GUARD_SIZE | |
BCEMT_UNSET_PRIORITY | |
BCEMT_SCHED_MIN | |
BCEMT_SCHED_MAX |
bslmt::ThreadAttributes::ThreadAttributes | ( | ) |
|
explicit |
Create a ThreadAttributes
object having the (default) attribute values:
detachedState() == e_CREATE_JOINABLE
guardSize() == e_UNSET_GUARD_SIZE
inheritSchedule() == true
schedulingPolicy() == e_SCHED_DEFAULT
schedulingPriority() == e_UNSET_PRIORITY
stackSize() == e_UNSET_STACK_SIZE
threadName() == ""
Optionally specify a basicAllocator
used to supply memory. If basicAllocator
is 0, the currently installed default allocator is used. bslmt::ThreadAttributes::ThreadAttributes | ( | const ThreadAttributes & | original, |
bslma::Allocator * | basicAllocator = 0 |
||
) |
Create a ThreadAttributes
object having the same value as the specified original
object. Optionally specify a basicAllocator
used to supply memory. If basicAllocator
is 0, the currently installed default allocator is used.
|
inline |
bslmt::ThreadAttributes::BSLMF_NESTED_TRAIT_DECLARATION | ( | ThreadAttributes | , |
bslma::UsesBslmaAllocator | |||
) |
|
inline |
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.
|
inline |
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.
|
inline |
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.
ThreadAttributes & bslmt::ThreadAttributes::operator= | ( | const ThreadAttributes & | rhs | ) |
Assign to this object the value of the specified rhs
object, and return a reference providing modifiable access to this object.
bsl::ostream & bslmt::ThreadAttributes::print | ( | bsl::ostream & | stream, |
int | level = 0 , |
||
int | spacesPerLevel = 4 |
||
) | const |
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.
|
inline |
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.
|
inline |
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.
|
inline |
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.
|
inline |
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
.
|
inline |
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.
|
inline |
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.
|
inline |
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.
|
inline |
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
.
|
inline |
Set the threadName
attribute of this object to the specified value
. Return a non-const
reference to this object (see also {Fluent Interface}).
|
inline |
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 .
|
inline |
Return the threadName
attribute of this object. Note that the returned string reference will be invalidated if setThreadName
is subsequently called on this object.