CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/FWCore/Services/src/UnixSignalService.cc

Go to the documentation of this file.
00001 #include <iostream>
00002 #include <cstdlib>
00003 
00004 #include "FWCore/Services/src/UnixSignalService.h"
00005 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00006 
00007 #include "FWCore/Utilities/interface/UnixSignalHandlers.h"
00008 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
00009 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
00010 
00011 namespace edm {
00012 
00013   namespace service {
00014 
00015     UnixSignalService::UnixSignalService(ParameterSet const& pset)
00016       : enableSigInt_(pset.getUntrackedParameter<bool>("EnableCtrlC")) {
00017       installCustomHandler(SIGUSR2, ep_sigusr2);
00018       if(enableSigInt_)  installCustomHandler(SIGINT, ep_sigusr2);
00019     }
00020 
00021     UnixSignalService::~UnixSignalService() {}
00022 
00023     void UnixSignalService::fillDescriptions(ConfigurationDescriptions& descriptions) {
00024       ParameterSetDescription desc;
00025       desc.addUntracked<bool>("EnableCtrlC", true)->setComment(
00026         "If 'true', you can stop a cmsRun job gracefully by sending it a '<control> c' keyboard interrupt (i.e. SIGINT).");
00027       descriptions.add("UnixSignalService", desc);
00028       descriptions.setComment(
00029         "This service sets up unix signal handlers for the unix signal SIGUSR2 and optionally SIGINT"
00030         " so that when cmsRun is sent a signal the application will stop processing and shut down gracefully.");
00031     }
00032   } // end of namespace service
00033 } // end of namespace edm