CMS 3D CMS Logo

OutputModuleBase.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: FWCore/Framework
4 // Class : OutputModuleBase
5 //
6 // Implementation:
7 // [Notes on implementation]
8 //
9 //
10 
11 // system include files
12 #include <cassert>
13 
14 // user include files
18 
19 namespace edm {
20  namespace limited {
21 
22  // -------------------------------------------------------
24  : core::OutputModuleCore(pset), queue_(pset.getUntrackedParameter<unsigned int>("concurrencyLimit")) {}
25 
27  auto nstreams = iPC.numberOfStreams();
28 
29  preallocStreams(nstreams);
31  preallocate(iPC);
32  }
33 
35 
37  ActivityRegistry* act,
38  ModuleCallingContext const* mcc) {
40 
41  auto remainingEvents = remainingEvents_.load();
42  bool keepTrying = remainingEvents > 0;
43  while (keepTrying) {
44  auto newValue = remainingEvents - 1;
45  keepTrying = !remainingEvents_.compare_exchange_strong(remainingEvents, newValue);
46  if (keepTrying) {
47  // the exchange failed because the value was changed by another thread.
48  // remainingEvents was changed to be the new value of remainingEvents_;
49  keepTrying = remainingEvents > 0;
50  }
51  }
52  return true;
53  }
54 
56  std::vector<std::string> const& defaultOutputCommands) {
57  core::OutputModuleCore::fillDescription(desc, defaultOutputCommands);
58  desc.addUntracked<unsigned int>("concurrencyLimit", 1);
59  }
60  } // namespace limited
61 } // namespace edm
static const TGPicture * info(bool iBackgroundIsBlack)
void doPreallocate(PreallocationConfiguration const &)
void doPreallocate_(PreallocationConfiguration const &)
Definition: __init__.py:1
OutputModuleBase(ParameterSet const &pset)
std::atomic< int > remainingEvents_
bool doEvent_(EventTransitionInfo const &, ActivityRegistry *, ModuleCallingContext const *)
virtual void preallocate(PreallocationConfiguration const &)
virtual void preallocStreams(unsigned int)
HLT enums.
static void fillDescription(ParameterSetDescription &desc, std::vector< std::string > const &iDefaultOutputCommands=ProductSelectorRules::defaultSelectionStrings())
bool doEvent(EventTransitionInfo const &, ActivityRegistry *, ModuleCallingContext const *)
static void fillDescription(ParameterSetDescription &desc, std::vector< std::string > const &iDefaultOutputCommands=ProductSelectorRules::defaultSelectionStrings())