Skip to content

Commit e7b0182

Browse files
committed
Made API to UnscheduledHander const
Changed member functions which would be called from multiple threads simultaneously const in order to distinguish them from the members which are only going to be called serially. This should aid in checking for thread-safety. A needed followup will be to make Worker thread-safe.
1 parent 37383df commit e7b0182

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

FWCore/Framework/interface/UnscheduledCallProducer.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace edm {
2727
WorkerLookup() = default;
2828

2929
using worker_container = std::vector<Worker*>;
30-
using iterator = worker_container::iterator;
30+
using const_iterator = worker_container::const_iterator;
3131

3232
void add(Worker* iWorker) {
3333
auto const& label = iWorker->description().moduleLabel();
@@ -47,8 +47,8 @@ namespace edm {
4747
return m_values[found->second];
4848
}
4949

50-
iterator begin() { return m_values.begin(); }
51-
iterator end() { return m_values.end(); }
50+
const_iterator begin() const { return m_values.begin(); }
51+
const_iterator end() const { return m_values.end(); }
5252

5353
private:
5454
//second element is the index of the key in m_values
@@ -64,7 +64,7 @@ namespace edm {
6464

6565
template <typename T, typename U>
6666
void runNow(typename T::MyPrincipal& p, EventSetup const& es, StreamID streamID,
67-
typename T::Context const* topContext, U const* context) {
67+
typename T::Context const* topContext, U const* context) const {
6868
//do nothing for event since we will run when requested
6969
if(!T::isEvent_) {
7070
for(auto worker: workerLookup_) {
@@ -109,7 +109,7 @@ namespace edm {
109109
virtual bool tryToFillImpl(std::string const& moduleLabel,
110110
EventPrincipal& event,
111111
EventSetup const& eventSetup,
112-
ModuleCallingContext const* mcc) {
112+
ModuleCallingContext const* mcc) const override {
113113
auto worker =
114114
workerLookup_.find(moduleLabel);
115115
if(worker != nullptr) {

FWCore/Framework/interface/UnscheduledHandler.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ namespace edm {
4444
///returns true if found an EDProducer and ran it
4545
bool tryToFill(std::string const& label,
4646
EventPrincipal& iEvent,
47-
ModuleCallingContext const* mcc);
47+
ModuleCallingContext const* mcc) const;
4848

4949
void setEventSetup(EventSetup const& iSetup) {
5050
m_setup = &iSetup;
@@ -54,7 +54,7 @@ namespace edm {
5454
virtual bool tryToFillImpl(std::string const&,
5555
EventPrincipal&,
5656
EventSetup const&,
57-
ModuleCallingContext const* mcc) = 0;
57+
ModuleCallingContext const* mcc) const = 0;
5858
// ---------- member data --------------------------------
5959
EventSetup const* m_setup;
6060
};

FWCore/Framework/src/UnscheduledHandler.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace edm {
2525
bool
2626
UnscheduledHandler::tryToFill(std::string const& label,
2727
EventPrincipal& iEvent,
28-
ModuleCallingContext const* mcc) {
28+
ModuleCallingContext const* mcc) const {
2929
assert(m_setup);
3030
return tryToFillImpl(label, iEvent, *m_setup, mcc);
3131
}

0 commit comments

Comments
 (0)