alpaqa 1.0.0a15
Nonconvex constrained optimization
Loading...
Searching...
No Matches
atomic-stop-signal.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <atomic>
4
5namespace alpaqa {
6
8 public:
9 AtomicStopSignal() = default;
14
15 void stop() { stop_flag.store(true, std::memory_order_seq_cst); }
16 [[nodiscard]] bool stop_requested() const {
17 return stop_flag.load(std::memory_order_relaxed);
18 }
19
20 private:
21 std::atomic<bool> stop_flag{false};
22};
23
24} // namespace alpaqa
AtomicStopSignal & operator=(AtomicStopSignal &&) noexcept
AtomicStopSignal(const AtomicStopSignal &)
AtomicStopSignal(AtomicStopSignal &&) noexcept
AtomicStopSignal & operator=(const AtomicStopSignal &)=delete
std::atomic< bool > stop_flag
constexpr const auto inf
Definition config.hpp:85