Skip to content

Commit

Permalink
variable rename to something more appropriate
Browse files Browse the repository at this point in the history
  • Loading branch information
nadrino committed Dec 1, 2024
1 parent 828b2e6 commit 6819183
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/DatasetManager/include/DataDispenser.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class DataDispenser : public JsonBaseClass {

// thread communication
GenericToolbox::Atomic<bool> requestReadNextEntry{false};
GenericToolbox::Atomic<bool> isNextEntryReady{false};
GenericToolbox::Atomic<bool> isEntryBufferReady{false};
GenericToolbox::Atomic<bool> isDoneReading{false};
GenericToolbox::Atomic<bool> isEventFillerReady{false};
};
Expand Down
10 changes: 5 additions & 5 deletions src/DatasetManager/src/DataDispenser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ void DataDispenser::runEventFillThreads(int iThread_){
if( not hasSample ){ continue; }

Int_t nBytes{ threadSharedData.treeChain->GetEntry(threadSharedData.currentEntryIndex) };
threadSharedData.isNextEntryReady.setValue(true); // loaded! -> let the other thread get everything it needs
threadSharedData.isEntryBufferReady.setValue(true); // loaded! -> let the other thread get everything it needs

if( iThread_ == 0 ){
readSpeed.addQuantity(nBytes * nThreads);
Expand All @@ -891,8 +891,8 @@ void DataDispenser::runEventFillThreads(int iThread_){
}
}

// make sure the indexer thread has received the signal for the last entry
threadSharedData.isNextEntryReady.waitUntilEqual( false );
// make sure the event filler thread has received the signal for the last entry
threadSharedData.isEntryBufferReady.waitUntilEqual( false );

// make sure currentEntryIndex don't get updated while it hasn't been read by the other thread
threadSharedData.requestReadNextEntry.waitUntilEqualThenToggle( true );
Expand All @@ -903,7 +903,7 @@ void DataDispenser::runEventFillThreads(int iThread_){
}

threadSharedData.isDoneReading.setValue( true ); // trigger the loop break
threadSharedData.isNextEntryReady.setValue( true ); // release
threadSharedData.isEntryBufferReady.setValue(true ); // release

// wait for the event filler threads to stop
eventFillerThread->get();
Expand Down Expand Up @@ -1049,7 +1049,7 @@ void DataDispenser::loadEvent(int iThread_){

// make sure we request a new entry and wait once we go for another loop
GenericToolbox::ScopedGuard readerGuard{
[&]{ threadSharedData.isNextEntryReady.waitUntilEqual( true ); threadSharedData.isNextEntryReady.setValue( false ); },
[&]{ threadSharedData.isEntryBufferReady.waitUntilEqual( true ); threadSharedData.isEntryBufferReady.setValue( false ); },
[&]{ threadSharedData.requestReadNextEntry.setValue( true ); }
};

Expand Down

0 comments on commit 6819183

Please sign in to comment.