mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/56717 The signal_handler was under the caffe2 namespacee but was being used by PyTorch as well. I've fixed this my moving it to the c10 namespace where now both C2 and PyTorch can use it. The signal_handler interface in caffe2/utils/signal_handler.h is kept the same for backward compatiblity for C2, but most of the commmon code is moved to c10. ghstack-source-id: 127446929 Test Plan: waitforbuildbot Reviewed By: ezyang Differential Revision: D27946738 fbshipit-source-id: d6228d1a0108f4c807d405e7a0bb799c5375388f
25 lines
698 B
C++
25 lines
698 B
C++
#pragma once
|
|
|
|
#include <c10/util/signal_handler.h>
|
|
|
|
namespace caffe2 {
|
|
|
|
#if defined(C10_SUPPORTS_FATAL_SIGNAL_HANDLERS)
|
|
class TORCH_API C2FatalSignalHandler : public c10::FatalSignalHandler {
|
|
public:
|
|
void fatalSignalHandlerPostProcess() override;
|
|
static C2FatalSignalHandler& getInstance();
|
|
|
|
private:
|
|
explicit C2FatalSignalHandler();
|
|
};
|
|
|
|
// This works by setting up certain fatal signal handlers. Previous fatal
|
|
// signal handlers will still be called when the signal is raised. Defaults
|
|
// to being off.
|
|
TORCH_API void setPrintStackTracesOnFatalSignal(bool print);
|
|
TORCH_API bool printStackTracesOnFatalSignal();
|
|
#endif // defined(C10_SUPPORTS_FATAL_SIGNAL_HANDLER)
|
|
|
|
} // namespace caffe2
|