Caffe2 - C++ API
A deep learning, cross platform ML framework
signal_handler.h
1 #pragma once
2 
3 namespace caffe2 {
4 
5 class SignalHandler {
6  public:
7  enum class Action {
8  NONE,
9  STOP
10  };
11 
12  // Contructor. Specify what action to take when a signal is received.
13  SignalHandler(Action SIGINT_action,
14  Action SIGHUP_action);
15  ~SignalHandler();
16 
17  Action CheckForSignals();
18 
19  private:
20  bool GotSIGINT();
21  bool GotSIGHUP();
22  Action SIGINT_action_;
23  Action SIGHUP_action_;
24  unsigned long my_sigint_count_;
25  unsigned long my_sighup_count_;
26 };
27 
28 } // namespace caffe2
Simple registry implementation in Caffe2 that uses static variables to register object creators durin...