pytorch/caffe2/utils/signal_handler.h
2016-07-21 11:26:41 -07:00

28 lines
506 B
C++

#pragma once
namespace caffe2 {
class SignalHandler {
public:
enum class Action {
NONE,
STOP
};
// Contructor. Specify what action to take when a signal is received.
SignalHandler(Action SIGINT_action,
Action SIGHUP_action);
~SignalHandler();
Action CheckForSignals();
private:
bool GotSIGINT();
bool GotSIGHUP();
Action SIGINT_action_;
Action SIGHUP_action_;
unsigned long my_sigint_count_;
unsigned long my_sighup_count_;
};
} // namespace caffe2