std::stop_s...equest_stop(3)
π NAME π
std::stop_source::request_stop β okay bestie, this is the std::stop_source::request_stop page from the C++ Standard Libary manual (section 3), and we are gonna make it make sense π
β¨ Synopsis β¨
bool request_stop() noexcept; (since C++20)
So like, this function issues a stop request to the stop-state β but only if the stop_source object has a stop-state and it has not yet already had stop requested. No cap.
The determination is made atomically, and if stop was requested, the stop-state is atomically updated to avoid race conditions, such that:
stop_requested()andstop_possible()can be concurrently invoked on otherstop_tokensandstop_sourcesof the same stop-state;request_stop()can be concurrently invoked on otherstop_sourceobjects, and only one will actually perform the stop request.
However, see the Notes section π
π Parameters π
(none) β literally none, bestie. You pass nothing.
π Return value π
true if the stop_source object has a stop-state and this invocation made a stop request; otherwise false.
πΈ Postconditions πΈ
stop_possible() is false or stop_requested() is true.
π₯ Notes π₯
If request_stop() does issue a stop request (i.e., returns true), then any stop_callbacks registered for the same associated stop-state will be invoked synchronously, on the same thread request_stop() is issued on. If an invocation of a callback exits via an exception, std::terminate is called. π
If the stop_source object has a stop-state but a stop request has already been made, this function returns false. However there is no guarantee that another stop_source object which has just (successfully) requested stop is not still in the middle of invoking a stop_callback function.
If request_stop() does issue a stop request (i.e., returns true), then all condition variables of base type std::condition_variable_any registered with an interruptible wait for stop_tokens associated with the stop_source's stop-state will be notified. β¨
π¦ Example π¦
This section is incomplete Reason: no example
π Category: π
Todo no example
And that's the whole vibe check, bestie β this came from http://cppreference.com, dated 2024.06.10, and the footer also says std::stop_s...equest_stop(3), so yeah, all the little details are kept π
π
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms