libcluon  0.0.148
TerminateHandler.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017-2018 Christian Berger
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
8 
9 #ifndef CLUON_TERMINATEHANDLER_HPP
10 #define CLUON_TERMINATEHANDLER_HPP
11 
12 #include "cluon/cluon.hpp"
13 
14 #include <atomic>
15 #include <csignal>
16 
17 namespace cluon {
18 
20  private:
21  TerminateHandler(const TerminateHandler &) = delete;
23  TerminateHandler &operator=(const TerminateHandler &) = delete;
24  TerminateHandler &operator=(TerminateHandler &&) = delete;
25 
26  public:
31  static TerminateHandler &instance() noexcept {
32  static TerminateHandler instance;
33  return instance;
34  }
35 
36  ~TerminateHandler() = default;
37 
38  public:
39  std::atomic<bool> isTerminated{false};
40 
41  private:
42  TerminateHandler() noexcept;
43 
44 #ifndef WIN32
45  struct sigaction m_signalHandler {};
46 #endif
47 };
48 } // namespace cluon
49 
50 #endif
Definition: TerminateHandler.hpp:19
Definition: cluon.hpp:65
#define LIBCLUON_API
Definition: cluon.hpp:56
static TerminateHandler & instance() noexcept
Definition: TerminateHandler.hpp:31