$darkmode
cloe
abort.hpp
Go to the documentation of this file.
1
/*
2
* Copyright 2020 Robert Bosch GmbH
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*
16
* SPDX-License-Identifier: Apache-2.0
17
*/
23
#pragma once
24
25
#include <atomic>
// for atomic_bool
26
#include <stdexcept>
// for exception
27
28
namespace
cloe {
29
40
using
AbortFlag
= std::atomic_bool;
41
45
class
AsyncAbort
:
public
std::exception {
46
public
:
47
using
exception::exception;
48
};
49
58
inline
void
abort_checkpoint
(
AbortFlag
& sig) {
59
if
(sig.load()) {
60
throw
AsyncAbort
();
61
}
62
}
63
64
}
// namespace cloe
cloe::AbortFlag
std::atomic_bool AbortFlag
Definition:
abort.hpp:40
cloe::abort_checkpoint
void abort_checkpoint(AbortFlag &sig)
Definition:
abort.hpp:58
cloe::AsyncAbort
Definition:
abort.hpp:45
runtime
include
cloe
core
abort.hpp
Generated on Mon Jul 15 2024 14:31:24 for cloe by
1.9.1