[#BloombergLP-bslstl-StopState]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::StopState
:relfileprefix: ../../
:mrdocs:

Shared stop state that tracks a stop request and registered callbacks&period;

== Synopsis

Declared in `&lt;bslstl&lowbar;stopstate&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class StopState;
----

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslstl/StopState/2constructor-00.adoc[`StopState`]         [.small]#[constructor]#
| Create a `StopState` object that initially has no registered callbacks and on which a stop has not been requested&period;
| xref:BloombergLP/bslstl/StopState/deregister.adoc[`deregister`] 
| If the callback of the specified `node` is currently executing, wait for it to complete&period; Otherwise, remove `node` from the list of nodes registered to this state&period; The behavior is undefined if this method is called more than once for a given `node` or if `node` was not previously registered to this state by a call to `enregister` that returned `true`&period;
| xref:BloombergLP/bslstl/StopState/enregister.adoc[`enregister`] 
| If a stop has already been requested, then invoke the callback of the specified `node` and return `false`&period; Otherwise, add `node` to the list of nodes registered to this state and return `true`&period; The behavior is undefined if this method is called more than once for a given `node`&period;
| xref:BloombergLP/bslstl/StopState/requestStop.adoc[`requestStop`] 
| If this `StopState` object has already had a stop requested, return `false`&period; Otherwise, atomically mark this `StopState` object as having had a stop requested, then execute all registered callbacks in an unspecified order, and finally return `true`&period;
| xref:BloombergLP/bslstl/StopState/stopRequested.adoc[`stopRequested`] 
| Return `true` if a stop has been requested on this `StopState` object, and `false` otherwise&period;
|===


== Derived Classes

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslstl/StopToken_RefCountedState.adoc[`StopToken&lowbar;RefCountedState`] 
| This component&hyphen;private struct adds a reference count to the internal `StopState` class&period; This reference count represents the number of `bsl&colon;&colon;stop&lowbar;source` objects that refer to the stop state (NOT the total number of objects that refer to the stop state)&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
