MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / FatalConditionHandler

Class FatalConditionHandler

extern/Catch2/catch.hpp:8009–8033  ·  view source on GitHub ↗

Wrapper for platform-specific fatal error (signals/SEH) handlers Tries to be cooperative with other handlers, and not step over other handlers. This means that unknown structured exceptions are passed on, previous signal handlers are called, and so on. Can only be instantiated once, and assumes that once a signal is caught, the binary will end up terminating. Thus, there

Source from the content-addressed store, hash-verified

8007 // Can only be instantiated once, and assumes that once a signal
8008 // is caught, the binary will end up terminating. Thus, there
8009 class FatalConditionHandler {
8010 bool m_started = false;
8011
8012 // Install/disengage implementation for specific platform.
8013 // Should be if-defed to work on current platform, can assume
8014 // engage-disengage 1:1 pairing.
8015 void engage_platform();
8016 void disengage_platform();
8017 public:
8018 // Should also have platform-specific implementations as needed
8019 FatalConditionHandler();
8020 ~FatalConditionHandler();
8021
8022 void engage() {
8023 assert(!m_started && "Handler cannot be installed twice.");
8024 m_started = true;
8025 engage_platform();
8026 }
8027
8028 void disengage() {
8029 assert(m_started && "Handler cannot be uninstalled without being installed first");
8030 m_started = false;
8031 disengage_platform();
8032 }
8033 };
8034
8035 //! Simple RAII guard for (dis)engaging the FatalConditionHandler
8036 class FatalConditionHandlerGuard {

Callers 1

catch.hppFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected