GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::stop_source(3) C++ Standard Libary std::stop_source(3)

std::stop_source - std::stop_source


Defined in header <stop_token>
class stop_source; (since C++20)


The stop_source class provides the means to issue a stop request, such as for
std::jthread cancellation. A stop request made for one stop_source object is visible
to all stop_sources and std::stop_tokens of the same associated stop-state; any
std::stop_callback(s) registered for associated std::stop_token(s) will be invoked,
and any std::condition_variable_any objects waiting on associated std::stop_token(s)
will be awoken.


Once a stop is requested, it cannot be withdrawn. Additional stop requests have no
effect.


constructor constructs new stop_source object
(public member function)
destructor destructs the stop_source object
(public member function)
operator= assigns the stop_source object
(public member function)


request_stop makes a stop request for the associated stop-state, if any
(public member function)
swap swaps two stop_source objects
(public member function)


get_token returns a stop_token for the associated stop-state
(public member function)
stop_requested checks whether the associated stop-state has been requested to stop
(public member function)
stop_possible checks whether associated stop-state can be requested to stop
(public member function)


operator== compares two std::stop_source objects
(function)
swap(std::stop_source) specializes the std::swap algorithm
(C++20) (function)


Helper constants


nostopstate a std::nostopstate_t instance for use in stop_source constructor
(C++20) (constant)


nostopstate_t placeholder type for use in stop_source constructor
(C++20) (class)


For the purposes of std::jthread cancellation the stop_source object should be
retrieved from the std::jthread object using get_stop_source(); or stop should be
requested directly from the std::jthread object using request_stop(). This will then
use the same associated stop-state as that passed into the std::jthread's invoked
function argument (i.e., the function being executed on its thread).


For other uses, however, a stop_source can be constructed separately using the
default constructor, which creates new stop-state.


Feature-test macro: __cpp_lib_jthread


This section is incomplete
Reason: no example

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.