Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
SignalHandler.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <cstdlib>
5
6#include "storm-config.h"
8
9namespace storm {
10namespace utility {
11namespace resources {
12
17inline void quickest_exit(int errorCode) {
18#if defined LINUX
19 std::quick_exit(errorCode);
20#elif defined MACOS
21 std::_Exit(errorCode);
22#else
23 std::abort();
24#endif
25}
26
31inline void setTimeoutAlarm(uint_fast64_t timeout) {
32 alarm(timeout);
33}
34
36 public:
37 // Explicitly delete copy constructor
39
40 // Explicitly delete copy constructor
41 void operator=(SignalInformation const&) = delete;
42
48 static SignalInformation& infos();
49
55 inline bool isTerminate() const {
56 return terminate;
57 }
58
64 inline void setTerminate(bool terminate) {
65 this->terminate = terminate;
66 }
67
73 inline int getErrorCode() const {
74 return lastSignal;
75 }
76
81 inline void setErrorCode(int errorCode) {
82 lastSignal = errorCode;
83 }
84
85 private:
91
95 virtual ~SignalInformation();
96
97 // Flag whether the program should terminate
98 bool terminate;
99 // Store last signal code
100 int lastSignal;
101};
102
103inline void resetTimeoutAlarm() {
105 alarm(0);
106}
107
113inline bool isTerminate() {
115}
116
120void installSignalHandler(int maximalWaitTime);
121
122} // namespace resources
123} // namespace utility
124} // namespace storm
void setErrorCode(int errorCode)
Set the error code.
int getErrorCode() const
Get the error code.
SignalInformation(SignalInformation const &)=delete
void operator=(SignalInformation const &)=delete
static SignalInformation & infos()
Retrieves the only existing instance of the signal information.
bool isTerminate() const
Check whether the program should terminate (due to some abort signal).
void setTerminate(bool terminate)
Set whether the program should terminate.
void quickest_exit(int errorCode)
Exit without cleanup.
void setTimeoutAlarm(uint_fast64_t timeout)
Set timeout by raising an alarm after timeout seconds.
bool isTerminate()
Check whether the program should terminate (due to some abort signal).
void installSignalHandler(int maximalWaitTime)
Register some signal handlers to detect and correctly handle abortion (due to timeout for example).
LabParser.cpp.
Definition cli.cpp:18