sas
Modularised monitoring, logging, and control of robots.
Toggle main menu visibility
Loading...
Searching...
No Matches
sas_shutdown_signaler.hpp
Go to the documentation of this file.
1
#pragma once
2
/*
3
# Copyright (c) 2022-2026 Murilo Marques Marinho
4
#
5
# This file is part of sas_core.
6
#
7
# sas_core is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU Lesser General Public License as published by
9
# the Free Software Foundation, either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# sas_core is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU Lesser General Public License for more details.
16
#
17
# You should have received a copy of the GNU Lesser General Public License
18
# along with sas_core. If not, see <https://www.gnu.org/licenses/>.
19
#
20
# ################################################################
21
#
22
# Author: Murilo M. Marinho, email: murilomarinho@ieee.org
23
#
24
# ################################################################*/
25
34
#include<atomic>
35
36
namespace
sas
37
{
44
class
ShutdownSignaler
45
{
46
private
:
47
std::atomic_bool* external_shutdown_signal_{
nullptr
};
48
bool
internal_shutdown_signal_{
false
};
49
public
:
53
ShutdownSignaler
() =
default
;
58
ShutdownSignaler
(std::atomic_bool* external_shutdown_signal):
59
external_shutdown_signal_(external_shutdown_signal)
60
{
61
62
};
63
68
bool
should_shutdown
();
69
73
void
shutdown
();
74
};
75
}
sas::ShutdownSignaler::ShutdownSignaler
ShutdownSignaler(std::atomic_bool *external_shutdown_signal)
Construct a ShutdownSignaler using an external atomic flag.
Definition
sas_shutdown_signaler.hpp:58
sas::ShutdownSignaler::shutdown
void shutdown()
Trigger a shutdown signal.
Definition
sas_shutdown_signaler.cpp:46
sas::ShutdownSignaler::ShutdownSignaler
ShutdownSignaler()=default
Default constructor.
sas::ShutdownSignaler::should_shutdown
bool should_shutdown()
Check whether a shutdown has been requested.
Definition
sas_shutdown_signaler.cpp:37
src
sas_core
include
sas_core
sas_shutdown_signaler.hpp
Generated by
1.17.0