Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Loading...
Searching...
No Matches
crash.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017 Roc authors
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//! @file roc_core/target_posix/roc_core/crash.h
10//! @brief Crash handling.
11
12#ifndef ROC_CORE_CRASH_H_
13#define ROC_CORE_CRASH_H_
14
15#include <signal.h>
16
17#include "roc_core/attributes.h"
19
20namespace roc {
21namespace core {
22
23//! Report a crash and abort application.
24void crash(const char* message) ROC_ATTR_NORETURN;
25
26//! Crash handler.
28public:
29 //! Install signal handlers.
31
32 //! Restore signal handlers.
34
35private:
36 void install_(int sig);
37
38 enum { MaxSigs = 8 };
39
40 struct sigaction sa_restore_[MaxSigs];
41 int sig_restore_[MaxSigs];
42 size_t restore_sz_;
43};
44
45} // namespace core
46} // namespace roc
47
48#endif // ROC_CORE_CRASH_H_
GCC attributes.
#define ROC_ATTR_NORETURN
Function never returns.
Definition: attributes.h:19
Crash handler.
Definition: crash.h:27
CrashHandler()
Install signal handlers.
~CrashHandler()
Restore signal handlers.
Base class for non-copyable objects.
Definition: noncopyable.h:23
void crash(const char *message) ROC_ATTR_NORETURN
Report a crash and abort application.
Root namespace.
Non-copyable object.