Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:12:14

0001 // -*- C++ -*-
0002 //
0003 // Package:     FWCore/Framework
0004 // Class  :     RunProcessingStatus
0005 //
0006 // Original Author:  W. David Dagenhart
0007 //         Created:  7 October 2021
0008 
0009 #include "RunProcessingStatus.h"
0010 #include "FWCore/Framework/interface/RunPrincipal.h"
0011 
0012 namespace edm {
0013   RunProcessingStatus::RunProcessingStatus(unsigned int iNStreams, WaitingTaskHolder const& holder)
0014       : holderOfTaskInProcessRuns_(holder),
0015         nStreamsStillProcessingBeginRun_(iNStreams),
0016         nStreamsStillProcessingRun_(iNStreams) {}
0017 
0018   void RunProcessingStatus::resetBeginResources() {
0019     endIOVWaitingTasks_.doneWaiting(std::exception_ptr{});
0020     for (auto& iter : eventSetupImpls_) {
0021       iter.reset();
0022     }
0023   }
0024 
0025   void RunProcessingStatus::resetEndResources() {
0026     endIOVWaitingTasksEndRun_.doneWaiting(std::exception_ptr{});
0027     for (auto& iter : eventSetupImplsEndRun_) {
0028       iter.reset();
0029     }
0030   }
0031 
0032   void RunProcessingStatus::setEndTime() {
0033     constexpr char kUnset = 0;
0034     constexpr char kSetting = 1;
0035     constexpr char kSet = 2;
0036 
0037     if (endTimeSetStatus_ != kSet) {
0038       //not already set
0039       char expected = kUnset;
0040       if (endTimeSetStatus_.compare_exchange_strong(expected, kSetting)) {
0041         runPrincipal_->setEndTime(endTime_);
0042         endTimeSetStatus_.store(kSet);
0043       } else {
0044         //wait until time is set
0045         while (endTimeSetStatus_.load() != kSet) {
0046         }
0047       }
0048     }
0049   }
0050 }  // namespace edm