mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-14 20:57:59 +00:00
28 lines
506 B
C++
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
|