1#ifndef YAZE_UTIL_STOP_TOKEN_H_
2#define YAZE_UTIL_STOP_TOKEN_H_
22 return state_ &&
state_->load(std::memory_order_acquire);
27 explicit StopToken(std::shared_ptr<std::atomic<bool>> state)
28 :
state_(std::move(state)) {}
30 std::shared_ptr<std::atomic<bool>>
state_;
41 return state_ && !
state_->exchange(
true, std::memory_order_acq_rel);
45 std::shared_ptr<std::atomic<bool>>
state_;
StopSource(NoStopStateTag) noexcept
StopToken get_token() const noexcept
bool request_stop() noexcept
std::shared_ptr< std::atomic< bool > > state_
std::shared_ptr< std::atomic< bool > > state_
bool stop_requested() const noexcept
bool has_stop_state() const noexcept
StopToken(std::shared_ptr< std::atomic< bool > > state)
constexpr NoStopStateTag kNoStopState