Skip to content

Commit a425941

Browse files
committed
destroy aggregator before equipments
1 parent 0b89c61 commit a425941

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/mainReadout.cxx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -339,10 +339,11 @@ int main(int argc, char* argv[])
339339
theLog.log("Creating aggregator");
340340
AliceO2::Common::Fifo<DataSetReference> agg_output(1000);
341341
int nEquipmentsAggregated=0;
342-
DataBlockAggregator agg(&agg_output,"Aggregator");
342+
auto agg=std::make_unique<DataBlockAggregator>(&agg_output,"Aggregator");
343+
343344
for (auto && readoutDevice : readoutDevices) {
344345
//theLog.log("Adding equipment: %s",readoutDevice->getName().c_str());
345-
agg.addInput(readoutDevice->dataOut);
346+
agg->addInput(readoutDevice->dataOut);
346347
nEquipmentsAggregated++;
347348
}
348349
theLog.log("Aggregator: %d equipments", nEquipmentsAggregated);
@@ -368,7 +369,7 @@ int main(int argc, char* argv[])
368369

369370

370371
theLog.log("Starting aggregator");
371-
agg.start();
372+
agg->start();
372373

373374
// notify consumers of imminent data flow start
374375
for (auto& c : dataConsumers) {
@@ -450,14 +451,15 @@ int main(int argc, char* argv[])
450451

451452

452453
theLog.log("Stopping aggregator");
453-
agg.stop();
454+
agg->stop();
454455

455456
theLog.log("Stopping consumers");
456457
// close consumers before closing readout equipments (owner of data blocks)
457458
dataConsumers.clear();
458459

459460
agg_output.clear();
460-
461+
agg=nullptr; // destroy aggregator, and release blocks it may still own.
462+
461463
// todo: check nothing in the input pipeline
462464
// flush & stop equipments
463465
for (auto && readoutDevice : readoutDevices) {
@@ -472,7 +474,7 @@ int main(int argc, char* argv[])
472474
for (size_t i = 0, size = readoutDevices.size(); i != size; ++i) {
473475
readoutDevices[i]=nullptr; // effectively deletes the device
474476
}
475-
readoutDevices.clear(); // to do it all in one go
477+
//readoutDevices.clear(); // to do it all in one go
476478

477479
if (latencyFd>=0) {
478480
close(latencyFd);

0 commit comments

Comments
 (0)