| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // ====================================================================== | ||
| 2 | // \title FatalHandlerImpl.cpp | ||
| 3 | // \author tcanham | ||
| 4 | // \brief cpp file for FatalHandler component implementation class | ||
| 5 | // | ||
| 6 | // \copyright | ||
| 7 | // Copyright 2009-2015, by the California Institute of Technology. | ||
| 8 | // ALL RIGHTS RESERVED. United States Government Sponsorship | ||
| 9 | // acknowledged. | ||
| 10 | // | ||
| 11 | // ====================================================================== | ||
| 12 | |||
| 13 | #include <Fw/FPrimeBasicTypes.hpp> | ||
| 14 | #include <Fw/Logger/Logger.hpp> | ||
| 15 | #include <Os/Task.hpp> | ||
| 16 | #include <Svc/FatalHandler/FatalHandlerComponentImpl.hpp> | ||
| 17 | #include <csignal> | ||
| 18 | #include <cstdlib> | ||
| 19 | |||
| 20 | namespace Svc { | ||
| 21 | |||
| 22 | // ---------------------------------------------------------------------- | ||
| 23 | // Handler implementations for user-defined typed input ports | ||
| 24 | // ---------------------------------------------------------------------- | ||
| 25 | |||
| 26 | ✗ | void FatalHandlerComponentImpl::FatalReceive_handler(const FwIndexType portNum, FwEventIdType Id) { | |
| 27 | // for **nix, delay then exit with error code | ||
| 28 | ✗ | Fw::Logger::log("FATAL %d handled.\n", Id); | |
| 29 | ✗ | (void)Os::Task::delay(Fw::TimeInterval(1, 0)); | |
| 30 | ✗ | Fw::Logger::log("Exiting with abort signal and core dump file.\n"); | |
| 31 | ✗ | (void)raise(SIGABRT); | |
| 32 | ✗ | exit(1); | |
| 33 | } | ||
| 34 | |||
| 35 | } // end namespace Svc | ||
| 36 |