Async signal safe backend implmented and notes about async-safety were added to the docs.

This commit is contained in:
Antony Polukhin
2016-11-30 10:47:58 +03:00
parent 7cbe206b45
commit fd513391ca
14 changed files with 182 additions and 35 deletions

View File

@@ -99,7 +99,7 @@ void my_terminate_handler() {
void my_signal_handler(int signum) {
boost::stacktrace::stacktrace bt;
if (bt) {
std::cerr << "Signal " << signum << ", backtrace:\n" << boost::stacktrace::stacktrace() << '\n'; // ``[footnote Strictly speaking this code is not async-signal-safe, but we have SIGSEGV already it could hardly become worse. [link boost_stacktrace.build_macros_and_backends Section "Build, Macros and Backends"] describes async-signal-safe backends, so if you will use the noop backend code becomes absolutely valid as that backens always returns 0 frames and `operator<<` will be never called. ]``
std::cerr << "Signal " << signum << ", backtrace:\n" << boost::stacktrace::stacktrace() << '\n'; // ``[footnote Strictly speaking this code is not async-signal-safe, because it uses std::cerr. [link boost_stacktrace.build_macros_and_backends Section "Build, Macros and Backends"] describes async-signal-safe backends, so if you will use the noop backend code becomes absolutely valid as that backens always returns 0 frames and `operator<<` will be never called. ]``
}
std::abort();
}