Skip to content
This repository was archived by the owner on Dec 9, 2025. It is now read-only.

Commit f0d3731

Browse files
committed
Revert "feature: add signal handler for termination"
This reverts commit 1fe9b8b.
1 parent 1fe9b8b commit f0d3731

File tree

1 file changed

+6
-48
lines changed

1 file changed

+6
-48
lines changed

lib/runtime.cpp

Lines changed: 6 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,6 @@
22
// Copyright Pionix GmbH and Contributors to EVerest
33

44
#include <framework/runtime.hpp>
5-
6-
#include <algorithm>
7-
#include <atomic>
8-
#include <cstdlib>
9-
#include <fstream>
10-
11-
#include <signal.h>
12-
13-
#include <boost/program_options.hpp>
14-
155
#include <utils/error.hpp>
166
#include <utils/error/error_factory.hpp>
177
#include <utils/error/error_json.hpp>
@@ -20,37 +10,15 @@
2010
#include <utils/error/error_state_monitor.hpp>
2111
#include <utils/filesystem.hpp>
2212

23-
namespace Everest {
24-
25-
namespace po = boost::program_options;
26-
27-
namespace {
28-
29-
static std::atomic_flag going_to_terminate = ATOMIC_FLAG_INIT;
13+
#include <algorithm>
14+
#include <cstdlib>
15+
#include <fstream>
3016

31-
void terminate_handler(int signal) {
32-
if (going_to_terminate.test_and_set()) {
33-
return;
34-
}
17+
#include <boost/program_options.hpp>
3518

36-
// NOTE (aw): calling exit() in a signal handler is not advised due
37-
// to race condition. For now we only do that in order for getting
38-
// gcov `atexit` handlers to run (to write out coverage statistics).
39-
// This should be properly handled by an event loop in the
40-
// corresponding process.
41-
exit(EXIT_FAILURE);
42-
};
43-
44-
void setup_signal_handlers() {
45-
struct sigaction action {};
46-
action.sa_handler = &terminate_handler;
47-
// action.sa_mask should be zero, so no blocked signals within the signal handler
48-
// action.sa_flags should be fine with being zero
49-
sigaction(SIGINT, &action, nullptr);
50-
sigaction(SIGTERM, &action, nullptr);
51-
}
19+
namespace Everest {
5220

53-
} // namespace
21+
namespace po = boost::program_options;
5422

5523
std::string parse_string_option(const po::variables_map& vm, const char* option) {
5624
if (vm.count(option) == 0) {
@@ -430,16 +398,6 @@ ModuleCallbacks::ModuleCallbacks(
430398

431399
ModuleLoader::ModuleLoader(int argc, char* argv[], ModuleCallbacks callbacks, VersionInformation version_information) :
432400
runtime_settings(nullptr), callbacks(std::move(callbacks)), version_information(std::move(version_information)) {
433-
434-
// FIXME (aw): this shouldn't been done in this constructor, but
435-
// rather in a seperate `framework/module_init` function. For now
436-
// we're leaving it here as the signal handlers should be set up as
437-
// early as possible - and the `ModuleLoader` is the thing, which
438-
// gets constructed first.
439-
// NOTE (aw): it was decided not to add this call to ev-cli in order
440-
// to reduce the amount of generated code.
441-
setup_signal_handlers();
442-
443401
if (!this->parse_command_line(argc, argv)) {
444402
this->should_exit = true;
445403
return;

0 commit comments

Comments
 (0)