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

56 lines
1.2 KiB
Markdown

[stoptoken.mem]
# 32 Concurrency support library [[thread]](./#thread)
## 32.3 Stop tokens [[thread.stoptoken]](thread.stoptoken#stoptoken.mem)
### 32.3.4 Class stop_token [[stoptoken]](stoptoken#mem)
#### 32.3.4.2 Member functions [stoptoken.mem]
[🔗](#lib:swap,stop_token)
`void swap(stop_token& rhs) noexcept;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L868)
*Effects*: Equivalent to:*stop-state*.swap(rhs.*stop-state*);
[🔗](#lib:stop_requested,stop_token)
`bool stop_requested() const noexcept;
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L882)
*Returns*: true if *stop-state* refers to a stop state
that has received a stop request;
otherwise, false[.](#2.sentence-1)
[🔗](#lib:stop_possible,stop_token)
`bool stop_possible() const noexcept;
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L895)
*Returns*: false if
- [(3.1)](#3.1)
*this is disengaged, or
- [(3.2)](#3.2)
a stop request was not made
and there are no associated stop_source objects;
otherwise, true[.](#3.sentence-1)