summaryrefslogtreecommitdiff
path: root/src/SignalHandler.cpp
Commit message (Collapse)AuthorAgeFilesLines
* fix: Fix rare crash in signal handlerJoel Rosdahl2023-02-011-46/+41
| | | | | | | | | | | | If the process is signaled after SignalHandler::~SignalHandler has run then this assert will trigger: ccache: SignalHandler.cpp:87: static void SignalHandler::on_signal(int): failed assertion: g_the_signal_handler Fix this by deregistering the signal handler function before destructing the SignalHandler object. Fixes #1246.
* fix(redis-storage): Ignore SIGPIPEJoel Rosdahl2021-09-091-0/+2
| | | | | | | | | | libhiredis doesn’t pass MSG_NOSIGNAL to send to ccache can die from SIGPIPE. Disable SIGPIPE so that the socket code receives EPIPE correctly. This should also fix a similar problem with the HTTP storage backend. Fixes #931.
* Remove system.hpp, including what’s needed insteadJoel Rosdahl2021-07-071-0/+3
| | | | This is the next step after a57f70eda32e99221de56f5499079b4f00dc2bc5.
* Suppress Clang-Tidy warning about including signal.hJoel Rosdahl2021-01-061-1/+1
| | | | | | | | sigaddset and similar functions are specified by POSIX to be in signal.h and the C++ csignal header only contains a subset of the signal.h declarations. Related to PR #758.
* Improve header inclusion for SignalHandlerJoel Rosdahl2021-01-061-3/+4
|
* Add ASSERT and DEBUG_ASSERT macrosJoel Rosdahl2020-09-211-3/+5
| | | | | | | | | | | | | | | | CMake always defines NDEBUG in release builds, so assertions are only enabled in debug builds. Assertions were however always enabled before switching to CMake. I prefer keeping assertions enabled in release builds as well unless they are part of a tight loop. Fix this by introducing two custom assertion macors: - ASSERT(condition): Like assert(condition) but always enabled. - DEBUG_ASSERT(condition): Like assert(condition), i.e. only enabled in debug builds. All usage of assert(condition) is converted to ASSERT(condition) since none of the assertions are made in performance-critical code.
* Refactor signal handling and process exit codeJoel Rosdahl2020-05-201-0/+143
* Added a SignalHandler class which encapsulates parts related to signal handling. * Moved data referenced by the exit functions to Context (compiler PID, pending temporary files and pending debug log files). * Let the Context destructor do what the exitfn functionality used to do. * Removed the now superfluous exitfn functionality.