CMS 3D CMS Logo

UnixSignalService.cc
Go to the documentation of this file.
1 /*----------------------------------------------------------------------
2 
3  UnixSignalService: At present, this defines a SIGUSR2 handler and
4  sets the shutdown flag when that signal has been raised.
5 
6  This service is instantiated at job startup.
7 
8  ----------------------------------------------------------------------*/
9 #include <iostream>
10 #include <cstdlib>
11 
13 
15 
19 
20 namespace edm {
21  namespace service {
23  public:
24  explicit UnixSignalService(ParameterSet const& ps);
26 
27  static void fillDescriptions(ConfigurationDescriptions& descriptions);
28 
29  private:
31  }; // class UnixSignalService
32  } // end of namespace service
33 } // end of namespace edm
34 
35 namespace edm {
36 
37  namespace service {
38 
40  : enableSigInt_(pset.getUntrackedParameter<bool>("EnableCtrlC")) {
42  if (enableSigInt_)
44  }
45 
47 
50  desc.addUntracked<bool>("EnableCtrlC", true)
51  ->setComment(
52  "If 'true', you can stop a cmsRun job gracefully by sending it a '<control> c' keyboard interrupt (i.e. "
53  "SIGINT).");
54  descriptions.add("UnixSignalService", desc);
55  descriptions.setComment(
56  "This service sets up unix signal handlers for the unix signal SIGUSR2 and optionally SIGINT"
57  " so that when cmsRun is sent a signal the application will stop processing and shut down gracefully.");
58  }
59  } // end of namespace service
60 } // end of namespace edm
61 
#define DEFINE_FWK_SERVICE_MAKER(concrete, maker)
Definition: ServiceMaker.h:102
edm::serviceregistry::ParameterSetMaker< UnixSignalService > UnixSignalMaker
static void fillDescriptions(ConfigurationDescriptions &descriptions)
void installCustomHandler(int signum, CFUNC func)
void setComment(std::string const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
HLT enums.
void ep_sigusr2(int, siginfo_t *, void *)
UnixSignalService(ParameterSet const &ps)