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 
21 namespace edm {
22  namespace service {
24  public:
25  explicit UnixSignalService(ParameterSet const& ps);
27 
28  static void fillDescriptions(ConfigurationDescriptions& descriptions);
29 
30  private:
32  }; // class UnixSignalService
33  } // end of namespace service
34 } // end of namespace edm
35 
36 namespace edm {
37 
38  namespace service {
39 
41  : enableSigInt_(pset.getUntrackedParameter<bool>("EnableCtrlC")) {
44  }
45 
47 
50  desc.addUntracked<bool>("EnableCtrlC", true)->setComment(
51  "If 'true', you can stop a cmsRun job gracefully by sending it a '<control> c' keyboard interrupt (i.e. SIGINT).");
52  descriptions.add("UnixSignalService", desc);
53  descriptions.setComment(
54  "This service sets up unix signal handlers for the unix signal SIGUSR2 and optionally SIGINT"
55  " so that when cmsRun is sent a signal the application will stop processing and shut down gracefully.");
56  }
57  } // end of namespace service
58 } // end of namespace edm
59 
63 
64 
#define DEFINE_FWK_SERVICE_MAKER(concrete, maker)
Definition: ServiceMaker.h:117
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
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)