File indexing completed on 2024-04-06 12:12:07
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #include <cassert>
0013
0014
0015 #include "FWCore/Framework/interface/global/OutputModuleBase.h"
0016
0017 #include "FWCore/Framework/interface/EventForOutput.h"
0018 #include "FWCore/Framework/interface/PreallocationConfiguration.h"
0019 #include "FWCore/Framework/src/EventAcquireSignalsSentry.h"
0020
0021 namespace edm {
0022 namespace global {
0023
0024
0025 OutputModuleBase::OutputModuleBase(ParameterSet const& pset) : core::OutputModuleCore(pset) {}
0026
0027 void OutputModuleBase::doPreallocate(PreallocationConfiguration const& iPC) {
0028 auto nstreams = iPC.numberOfStreams();
0029 preallocStreams(nstreams);
0030 core::OutputModuleCore::doPreallocate_(iPC);
0031 preallocate(iPC);
0032 }
0033
0034 void OutputModuleBase::doBeginJob() { core::OutputModuleCore::doBeginJob_(); }
0035
0036 bool OutputModuleBase::doEvent(EventTransitionInfo const& info,
0037 ActivityRegistry* act,
0038 ModuleCallingContext const* mcc) {
0039 { core::OutputModuleCore::doEvent_(info, act, mcc); }
0040
0041 auto remainingEvents = remainingEvents_.load();
0042 bool keepTrying = remainingEvents > 0;
0043 while (keepTrying) {
0044 auto newValue = remainingEvents - 1;
0045 keepTrying = !remainingEvents_.compare_exchange_strong(remainingEvents, newValue);
0046 if (keepTrying) {
0047
0048
0049 keepTrying = remainingEvents > 0;
0050 }
0051 }
0052 return true;
0053 }
0054
0055 void OutputModuleBase::doAcquire(EventTransitionInfo const& info,
0056 ActivityRegistry* act,
0057 ModuleCallingContext const* mcc,
0058 WaitingTaskWithArenaHolder& holder) {
0059 EventForOutput e(info, moduleDescription(), mcc);
0060 e.setConsumer(this);
0061 EventAcquireSignalsSentry sentry(act, mcc);
0062 this->doAcquire_(e.streamID(), e, holder);
0063 }
0064 }
0065 }