32 lines
1.5 KiB
Markdown
32 lines
1.5 KiB
Markdown
[stoptoken.general]
|
||
|
||
# 32 Concurrency support library [[thread]](./#thread)
|
||
|
||
## 32.3 Stop tokens [[thread.stoptoken]](thread.stoptoken#stoptoken.general)
|
||
|
||
### 32.3.4 Class stop_token [[stoptoken]](stoptoken#general)
|
||
|
||
#### 32.3.4.1 General [stoptoken.general]
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L826)
|
||
|
||
The class stop_token models the concept [stoppable_token](stoptoken.concepts#concept:stoppable_token "32.3.3 Stop token concepts [stoptoken.concepts]")[.](#1.sentence-1)
|
||
|
||
It shares ownership of its stop state, if any,
|
||
with its associated stop_source object ([[stopsource]](stopsource "32.3.5 Class stop_source")) and
|
||
any stop_token objects to which it compares equal[.](#1.sentence-2)
|
||
|
||
namespace std {class stop_token {public:template<class CallbackFn>using callback_type = stop_callback<CallbackFn>;
|
||
|
||
stop_token() noexcept = default; // [[stoptoken.mem]](stoptoken.mem "32.3.4.2 Member functions"), member functionsvoid swap(stop_token&) noexcept; bool stop_requested() const noexcept; bool stop_possible() const noexcept; bool operator==(const stop_token& rhs) noexcept = default; private: shared_ptr<*unspecified*> *stop-state*; // *exposition only*};}
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L856)
|
||
|
||
*stop-state* refers to the stop_token's associated stop state[.](#2.sentence-1)
|
||
|
||
A stop_token object is disengaged when *stop-state* is empty[.](#2.sentence-2)
|