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

84 lines
3.1 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.inplace]
# 32 Concurrency support library [[thread]](./#thread)
## 32.3 Stop tokens [[thread.stoptoken]](thread.stoptoken#stopsource.inplace)
### 32.3.9 Class inplace_stop_source [stopsource.inplace]
#### [32.3.9.1](#general) General [[stopsource.inplace.general]](stopsource.inplace.general)
[1](#general-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L1241)
The class inplace_stop_source models [*stoppable-source*](stoptoken.concepts#concept:stoppable-source "32.3.3Stop token concepts[stoptoken.concepts]")[.](#general-1.sentence-1)
namespace std {class inplace_stop_source {public:// [[stopsource.inplace.cons]](#cons "32.3.9.2Constructors"), constructorsconstexpr inplace_stop_source() noexcept;
inplace_stop_source(inplace_stop_source&&) = delete;
inplace_stop_source(const inplace_stop_source&) = delete;
inplace_stop_source& operator=(inplace_stop_source&&) = delete;
inplace_stop_source& operator=(const inplace_stop_source&) = delete; ~inplace_stop_source(); // [[stopsource.inplace.mem]](#mem "32.3.9.3Member functions"), stop handlingconstexpr inplace_stop_token get_token() const noexcept; static constexpr bool stop_possible() noexcept { return true; }bool stop_requested() const noexcept; bool request_stop() noexcept; };}
#### [32.3.9.2](#cons) Constructors [[stopsource.inplace.cons]](stopsource.inplace.cons)
[🔗](#cons-itemdecl:1)
`constexpr inplace_stop_source() noexcept;
`
[1](#cons-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L1273)
*Effects*: Initializes a new stop state inside *this[.](#cons-1.sentence-1)
[2](#cons-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L1277)
*Postconditions*: stop_requested() is false[.](#cons-2.sentence-1)
#### [32.3.9.3](#mem) Member functions [[stopsource.inplace.mem]](stopsource.inplace.mem)
[🔗](#mem-itemdecl:1)
`constexpr inplace_stop_token get_token() const noexcept;
`
[1](#mem-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L1289)
*Returns*: A new associated inplace_stop_token object
whose *stop-source* member is equal to this[.](#mem-1.sentence-1)
[🔗](#mem-itemdecl:2)
`bool stop_requested() const noexcept;
`
[2](#mem-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L1300)
*Returns*: true if the stop state inside *this has received a stop request; otherwise, false[.](#mem-2.sentence-1)
[🔗](#mem-itemdecl:3)
`bool request_stop() noexcept;
`
[3](#mem-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L1311)
*Effects*: Executes a stop request operation ([[stoptoken.concepts]](stoptoken.concepts "32.3.3Stop token concepts"))[.](#mem-3.sentence-1)
[4](#mem-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/threads.tex#L1315)
*Postconditions*: stop_requested() is true[.](#mem-4.sentence-1)