alpaqa
1.0.0a12
Nonconvex constrained optimization
Loading...
Searching...
No Matches
src
alpaqa
include
alpaqa
util
atomic-stop-signal.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <atomic>
4
5
namespace
alpaqa
{
6
7
class
AtomicStopSignal
{
8
public
:
9
AtomicStopSignal
() =
default
;
10
AtomicStopSignal
(
const
AtomicStopSignal
&) :
AtomicStopSignal
() {}
11
AtomicStopSignal
&
operator=
(
const
AtomicStopSignal
&) =
delete
;
12
AtomicStopSignal
(
AtomicStopSignal
&&) :
AtomicStopSignal
() {}
13
AtomicStopSignal
&
operator=
(
AtomicStopSignal
&&) {
return
*
this
; }
14
15
void
stop
() {
stop_flag
.store(
true
, std::memory_order_relaxed); }
16
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
alpaqa::AtomicStopSignal
Definition
atomic-stop-signal.hpp:7
alpaqa::AtomicStopSignal::AtomicStopSignal
AtomicStopSignal(const AtomicStopSignal &)
Definition
atomic-stop-signal.hpp:10
alpaqa::AtomicStopSignal::stop
void stop()
Definition
atomic-stop-signal.hpp:15
alpaqa::AtomicStopSignal::operator=
AtomicStopSignal & operator=(const AtomicStopSignal &)=delete
alpaqa::AtomicStopSignal::stop_requested
bool stop_requested() const
Definition
atomic-stop-signal.hpp:16
alpaqa::AtomicStopSignal::AtomicStopSignal
AtomicStopSignal()=default
alpaqa::AtomicStopSignal::AtomicStopSignal
AtomicStopSignal(AtomicStopSignal &&)
Definition
atomic-stop-signal.hpp:12
alpaqa::AtomicStopSignal::operator=
AtomicStopSignal & operator=(AtomicStopSignal &&)
Definition
atomic-stop-signal.hpp:13
alpaqa::AtomicStopSignal::stop_flag
std::atomic< bool > stop_flag
Definition
atomic-stop-signal.hpp:21
alpaqa
Definition
anderson.hpp:10
Generated on Wed Sep 27 2023 for alpaqa by
1.9.8