Allow disabling signal handling, turn signal handling off by default.
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
c445536aed
commit
09bc55ec94
|
@ -7,7 +7,7 @@ std::string ExceptionHandler::_ArbutilsLastException = "";
|
||||||
/// @brief Returns a null-terminated C string to the last exception found.
|
/// @brief Returns a null-terminated C string to the last exception found.
|
||||||
export const char* Arbutils_C_GetLastException() { return ExceptionHandler::GetLastException(); }
|
export const char* Arbutils_C_GetLastException() { return ExceptionHandler::GetLastException(); }
|
||||||
|
|
||||||
#if !WINDOWS
|
#if !WINDOWS && SIGNAL_HANDLING
|
||||||
static ArbUt::SignalHandling sh;
|
static ArbUt::SignalHandling sh;
|
||||||
/// @brief Sets a callback to a function to run when a signal occurs.
|
/// @brief Sets a callback to a function to run when a signal occurs.
|
||||||
export void Arbutils_C_SetSignalCallback(void (*callback)(const char*)) { sh.SetCallback(callback); }
|
export void Arbutils_C_SetSignalCallback(void (*callback)(const char*)) { sh.SetCallback(callback); }
|
||||||
|
|
|
@ -11,6 +11,7 @@ option(SHARED "Whether we should build a shared library, instead of a static one
|
||||||
option(TESTS "Whether the test executable should be build as well." OFF)
|
option(TESTS "Whether the test executable should be build as well." OFF)
|
||||||
option(STATICC "Whether gcc and stdc++ should be linked statically to the library." OFF)
|
option(STATICC "Whether gcc and stdc++ should be linked statically to the library." OFF)
|
||||||
option(PRETTYTRACES "Whether full stacktraces should be included. Note that this adds a dependency to libdw." ON)
|
option(PRETTYTRACES "Whether full stacktraces should be included. Note that this adds a dependency to libdw." ON)
|
||||||
|
option(SIGNAL_HANDLING "whether to include signal handling." OFF)
|
||||||
|
|
||||||
# Set whether we want a static or shared library.
|
# Set whether we want a static or shared library.
|
||||||
set(LIBTYPE STATIC)
|
set(LIBTYPE STATIC)
|
||||||
|
@ -46,6 +47,10 @@ if (NOT WINDOWS AND PRETTYTRACES)
|
||||||
set(LINKS ${LINKS} -ldw)
|
set(LINKS ${LINKS} -ldw)
|
||||||
ADD_DEFINITIONS(-DPRETTYTRACES=1)
|
ADD_DEFINITIONS(-DPRETTYTRACES=1)
|
||||||
endif()
|
endif()
|
||||||
|
if (SIGNAL_HANDLING)
|
||||||
|
ADD_DEFINITIONS(-DSIGNAL_HANDLING=1)
|
||||||
|
endif()
|
||||||
|
|
||||||
# If we want to link the C and C++ library statically, link those as well.
|
# If we want to link the C and C++ library statically, link those as well.
|
||||||
if (STATICC)
|
if (STATICC)
|
||||||
set(LINKS ${LINKS} -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread)
|
set(LINKS ${LINKS} -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "SignalHandling.hpp"
|
#include "SignalHandling.hpp"
|
||||||
|
|
||||||
#if !WINDOWS
|
#if !WINDOWS && SIGNAL_HANDLING
|
||||||
/// \cond SKIP
|
/// \cond SKIP
|
||||||
void (*ArbUt::SignalHandling::_callback)(const char*) = nullptr;
|
void (*ArbUt::SignalHandling::_callback)(const char*) = nullptr;
|
||||||
/// \endcond
|
/// \endcond
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#ifndef ARBUTILS_SIGNALHANDLING_HPP
|
#ifndef ARBUTILS_SIGNALHANDLING_HPP
|
||||||
#define ARBUTILS_SIGNALHANDLING_HPP
|
#define ARBUTILS_SIGNALHANDLING_HPP
|
||||||
|
#if SIGNAL_HANDLING
|
||||||
#if PRETTYTRACES && !WINDOWS
|
#if PRETTYTRACES && !WINDOWS
|
||||||
#define BACKWARD_HAS_DW 1
|
#define BACKWARD_HAS_DW 1
|
||||||
#include "../extern/backward.hpp"
|
#include "../extern/backward.hpp"
|
||||||
|
@ -176,4 +177,5 @@ namespace ArbUt {
|
||||||
/// @fn ArbUt::SignalHandling::loaded()
|
/// @fn ArbUt::SignalHandling::loaded()
|
||||||
/// @brief Whether or not the signal handler is loaded
|
/// @brief Whether or not the signal handler is loaded
|
||||||
|
|
||||||
|
#endif // SIGNAL_HANDLING
|
||||||
#endif // ARBUTILS_SIGNALHANDLING_HPP
|
#endif // ARBUTILS_SIGNALHANDLING_HPP
|
||||||
|
|
Loading…
Reference in New Issue