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
8namespace sf
9{
10
16{
17 public:
22 explicit SegmentFaultHandler(const std::function<void()>& cb);
23
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
Class which intercepts SIGSEGV signals caused in a callback lambda function and recovers from it....
Definition SegmentFaultHandler.h:16
SegmentFaultHandler(const std::function< void()> &cb)
Default constructor.
~SegmentFaultHandler()
Destructor cleaning up.
#define _MISC_CLASS
Definition misc/global.h:40
Definition Application.h:10