Files
2025-10-25 03:02:53 +03:00

28 lines
1.7 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[stopsource.general]
# 32 Concurrency support library [[thread]](./#thread)
## 32.3 Stop tokens [[thread.stoptoken]](thread.stoptoken#stopsource.general)
### 32.3.5 Class stop_source [[stopsource]](stopsource#general)
#### 32.3.5.1 General [stopsource.general]
namespace std {class stop_source {public:// [[stopsource.cons]](stopsource.cons "32.3.5.2Constructors, copy, and assignment"), constructors, copy, and assignment stop_source(); explicit stop_source(nostopstate_t) noexcept {}// [[stopsource.mem]](stopsource.mem "32.3.5.3Member functions"), member functionsvoid swap(stop_source&) noexcept;
stop_token get_token() const noexcept; bool stop_possible() const noexcept; bool stop_requested() const noexcept; bool request_stop() noexcept; bool operator==(const stop_source& rhs) noexcept = default; private: shared_ptr<*unspecified*> *stop-state*; // *exposition only*};}
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L935)
*stop-state* refers to the stop_source's associated stop state[.](#1.sentence-1)
A stop_source object is disengaged when *stop-state* is empty[.](#1.sentence-2)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L939)
stop_source models[*stoppable-source*](stoptoken.concepts#concept:stoppable-source "32.3.3Stop token concepts[stoptoken.concepts]"),[copyable](concepts.object#concept:copyable "18.6Object concepts[concepts.object]"),[equality_comparable](concept.equalitycomparable#concept:equality_comparable "18.5.4Concept equality_­comparable[concept.equalitycomparable]"), and[swappable](concept.swappable#concept:swappable "18.4.9Concept swappable[concept.swappable]")[.](#2.sentence-1)