5#ifdef __cpp_lib_jthread
15#ifdef __cpp_lib_jthread
21 explicit stop_token(std::shared_ptr<std::atomic<bool>> shared_state) :
22 shared_state_{std::move(shared_state)}
32 return *shared_state_;
36 std::shared_ptr<std::atomic<bool>> shared_state_;
52 const bool has_stop_state = shared_state_ !=
nullptr;
53 const bool already_stopped = shared_state_->exchange(
true);
55 return has_stop_state
and not already_stopped;
64 std::shared_ptr<std::atomic<bool>> shared_state_ = std::make_shared<std::atomic<bool>>(
false);
Definition stop_token.h:40
stop_source(stop_source const &)=delete
stop_token get_token() const noexcept
Definition stop_token.h:58
stop_source(stop_source &&) noexcept=default
bool request_stop() noexcept
Definition stop_token.h:49
Definition stop_token.h:19
bool stop_requested() const noexcept
Definition stop_token.h:30
stop_token(stop_token const &)=delete
stop_token(stop_token &&) noexcept=default
stop_token(std::shared_ptr< std::atomic< bool > > shared_state)
Definition stop_token.h:21
Definition stop_token.h:14
and
Definition algorithms.h:158