File indexing completed on 2024-04-06 12:12:11
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #include "LuminosityBlockProcessingStatus.h"
0014 #include "FWCore/Framework/interface/LuminosityBlockPrincipal.h"
0015
0016 namespace edm {
0017 void LuminosityBlockProcessingStatus::resetResources() {
0018 endIOVWaitingTasks_.doneWaiting(std::exception_ptr{});
0019 for (auto& iter : eventSetupImpls_) {
0020 iter.reset();
0021 }
0022 resumeGlobalLumiQueue();
0023 }
0024
0025 void LuminosityBlockProcessingStatus::setGlobalEndRunHolder(WaitingTaskHolder holder) {
0026 globalEndRunHolder_ = std::move(holder);
0027 }
0028
0029 bool LuminosityBlockProcessingStatus::shouldStreamStartLumi() {
0030 if (state_ == State::kNoMoreEvents)
0031 return false;
0032
0033 bool changed = false;
0034 do {
0035 auto expected = State::kRunning;
0036 changed = state_.compare_exchange_strong(expected, State::kUpdating);
0037 if (expected == State::kNoMoreEvents)
0038 return false;
0039 } while (changed == false);
0040
0041 ++nStreamsProcessingLumi_;
0042 state_ = State::kRunning;
0043 return true;
0044 }
0045
0046 void LuminosityBlockProcessingStatus::noMoreEventsInLumi() {
0047 bool changed = false;
0048 do {
0049 auto expected = State::kRunning;
0050 changed = state_.compare_exchange_strong(expected, State::kUpdating);
0051 assert(expected != State::kNoMoreEvents);
0052 } while (changed == false);
0053 nStreamsStillProcessingLumi_.store(nStreamsProcessingLumi_);
0054 state_ = State::kNoMoreEvents;
0055 }
0056
0057 void LuminosityBlockProcessingStatus::setEndTime() {
0058 constexpr char kUnset = 0;
0059 constexpr char kSetting = 1;
0060 constexpr char kSet = 2;
0061
0062 if (endTimeSetStatus_ != kSet) {
0063
0064 char expected = kUnset;
0065 if (endTimeSetStatus_.compare_exchange_strong(expected, kSetting)) {
0066 lumiPrincipal_->setEndTime(endTime_);
0067 endTimeSetStatus_.store(kSet);
0068 } else {
0069
0070 while (endTimeSetStatus_.load() != kSet) {
0071 }
0072 }
0073 }
0074 }
0075 }