Skip to content

Commit 281c597

Browse files
committed
Use ResetOwner methods of iterator
In both HADAQ and DOGMA after plain buffer reading one can transfer ownership directly
1 parent 312cfdc commit 281c597

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

plugins/dogma/src/CombinerModule.cxx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -707,12 +707,15 @@ bool dogma::CombinerModule::ShiftToNextBuffer(unsigned ninp)
707707

708708
dabc::Buffer buf;
709709

710+
bool full_buffer_control = false;
711+
710712
if (cfg.fResortIndx < 0) {
711713
// normal way to take next buffer
712714
if(!CanRecv(ninp))
713715
return false;
714716
buf = Recv(ninp);
715717
fNumReadBuffers++;
718+
full_buffer_control = true;
716719
} else {
717720
// do not try to look further than one more buffer
718721
if (cfg.fResortIndx > 1)
@@ -722,15 +725,14 @@ bool dogma::CombinerModule::ShiftToNextBuffer(unsigned ninp)
722725
}
723726

724727
if (buf.GetTypeId() == dabc::mbt_EOF) {
725-
printf("SEE EOF %u\n", ninp);
726728
if (cfg.fResortIndx < 0)
727729
ProcessEOF(ninp);
728730
return false;
729731
}
730732

731733
DOUT5("CombinerModule::ShiftToNextBuffer %d type %u size %u", ninp, buf.GetTypeId(), buf.GetTotalSize());
732734

733-
return iter.Reset(buf);
735+
return full_buffer_control ? iter.ResetOwner(buf) : iter.Reset(buf);
734736
}
735737

736738
bool dogma::CombinerModule::ShiftToNextTu(unsigned ninp)

plugins/hadaq/src/CombinerModule.cxx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -578,14 +578,19 @@ bool hadaq::CombinerModule::ShiftToNextBuffer(unsigned ninp)
578578

579579
dabc::Buffer buf;
580580

581+
bool full_buffer_control = false;
582+
581583
if (cfg.fResortIndx < 0) {
582584
// normal way to take next buffer
583-
if(!CanRecv(ninp)) return false;
585+
if(!CanRecv(ninp))
586+
return false;
584587
buf = Recv(ninp);
585588
fNumReadBuffers++;
589+
full_buffer_control = true;
586590
} else {
587591
// do not try to look further than one more buffer
588-
if (cfg.fResortIndx>1) return false;
592+
if (cfg.fResortIndx > 1)
593+
return false;
589594
// when doing resort, try to access buffers from the input queue
590595
buf = RecvQueueItem(ninp, cfg.fResortIndx++);
591596
}
@@ -595,7 +600,7 @@ bool hadaq::CombinerModule::ShiftToNextBuffer(unsigned ninp)
595600
return false;
596601
}
597602

598-
return iter.Reset(buf);
603+
return full_buffer_control ? iter.ResetOwner(buf) : iter.Reset(buf);
599604
}
600605

601606
bool hadaq::CombinerModule::ShiftToNextHadTu(unsigned ninp)

0 commit comments

Comments
 (0)