CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
LockService.cc
Go to the documentation of this file.
7 
8 #include <algorithm>
9 #include <iostream>
10 
11 using namespace edm::rootfix;
12 
14  ActivityRegistry& reg):
15  lock_(*getGlobalMutex()),
16  locker_(),
17  labels_(iPS.getUntrackedParameter<Labels>("labels")),
18  lockSources_(iPS.getUntrackedParameter<bool>("lockSources")) {
21 
22  // reg.watchPostBeginJob(this,&LockService::postBeginJob);
23  // reg.watchPostEndJob(this,&LockService::postEndJob);
24 
25  // reg.watchPreProcessEvent(this,&LockService::preEventProcessing);
26  // reg.watchPostProcessEvent(this,&LockService::postEventProcessing);
29 
32 
33  FDEBUG(4) << "In LockServices" << std::endl;
34 }
35 
37 }
38 
41  std::vector<std::string> defaultVector;
42  desc.addUntracked<std::vector<std::string> >("labels",defaultVector);
43  desc.addUntracked<bool>("lockSources",true);
44  descriptions.add("LockService", desc);
45 }
46 
48  if(!labels_.empty() &&
49  find(labels_.begin(), labels_.end(), desc.moduleLabel()) != labels_.end()) {
50  //search_all(labels_, desc.moduleLabel()))
51  FDEBUG(4) << "made a new locked in LockService" << std::endl;
52  locker_.reset(new boost::mutex::scoped_lock(lock_));
53  }
54 }
55 
57  FDEBUG(4) << "destroyed a locked in LockService" << std::endl;
58  locker_.reset();
59 }
60 
62 }
63 
65 }
66 
68 }
69 
71 }
72 
74  if(lockSources_) {
75  FDEBUG(4) << "made a new locked in LockService" << std::endl;
76  locker_.reset(new boost::mutex::scoped_lock(lock_));
77  }
78 }
79 
81  FDEBUG(4) << "destroyed a locked in LockService" << std::endl;
82  locker_.reset();
83 }
84 
86  if(!labels_.empty() && find(labels_.begin(), labels_.end(), desc.moduleLabel()) != labels_.end()) {
87  //search_all(labels_, desc.moduleLabel()))
88  FDEBUG(4) << "made a new locked in LockService" << std::endl;
89  locker_.reset(new boost::mutex::scoped_lock(lock_));
90  }
91 }
92 
94  FDEBUG(4) << "destroyed a locked in LockService" << std::endl;
95  locker_.reset();
96 }
97 
void preModule(const edm::ModuleDescription &)
Definition: LockService.cc:85
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void preSourceConstruction(const edm::ModuleDescription &)
Definition: LockService.cc:47
boost::mutex * getGlobalMutex()
Definition: GlobalMutex.cc:3
std::vector< std::string > Labels
Definition: LockService.h:60
void watchPostModule(PostModule::slot_type const &iSlot)
void preEventProcessing(const edm::EventID &, const edm::Timestamp &)
Definition: LockService.cc:67
void watchPreSourceConstruction(PreSourceConstruction::slot_type const &iSlot)
void watchPostSourceConstruction(PostSourceConstruction::slot_type const &iSlot)
void postEventProcessing(const edm::Event &, const edm::EventSetup &)
Definition: LockService.cc:70
#define FDEBUG(lev)
Definition: DebugMacros.h:18
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::string const & moduleLabel() const
void watchPreModule(PreModule::slot_type const &iSlot)
LockService(const edm::ParameterSet &, edm::ActivityRegistry &)
Definition: LockService.cc:13
void postSourceConstruction(const edm::ModuleDescription &)
Definition: LockService.cc:56
void watchPreSource(PreSource::slot_type const &iSlot)
boost::shared_ptr< boost::mutex::scoped_lock > locker_
Definition: LockService.h:59
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: LockService.cc:39
void add(std::string const &label, ParameterSetDescription const &psetDescription)
boost::mutex & lock_
Definition: LockService.h:58
void watchPostSource(PostSource::slot_type const &iSlot)
void postModule(const edm::ModuleDescription &)
Definition: LockService.cc:93