Scanframe Modular Application
0.1.0
Loading...
Searching...
No Matches
SegmentFaultHandler.h
Go to the documentation of this file.
1
#pragma once
2
#include <csetjmp>
3
#include <csignal>
4
#include <functional>
5
#include <
misc/global.h
>
6
#include <vector>
7
8
namespace
sf
9
{
10
15
class
_MISC_CLASS
SegmentFaultHandler
16
{
17
public
:
22
explicit
SegmentFaultHandler
(
const
std::function<
void
()>& cb);
23
27
~SegmentFaultHandler
();
28
32
explicit
operator
bool()
const
;
33
34
private
:
35
struct
Entry
36
{
37
jmp_buf _buf{};
38
int
_counter{0};
39
};
43
Entry* _entry{
nullptr
};
47
static
__sighandler_t _savedHandler;
51
static
std::vector<Entry> _buffers;
56
static
void
handler(
int
cause);
57
};
58
59
}
// namespace sf
sf::SegmentFaultHandler
Class which intercepts SIGSEGV signals caused in a callback lambda function and recovers from it....
Definition
SegmentFaultHandler.h:16
sf::SegmentFaultHandler::SegmentFaultHandler
SegmentFaultHandler(const std::function< void()> &cb)
Default constructor.
sf::SegmentFaultHandler::~SegmentFaultHandler
~SegmentFaultHandler()
Destructor cleaning up.
global.h
_MISC_CLASS
#define _MISC_CLASS
Definition
misc/global.h:40
sf
Definition
Application.h:10
src
com
misc
lnx
SegmentFaultHandler.h
Generated by
1.9.8