Skip to content

Commit 254fa66

Browse files
authored
DPL: avoid concurrent access to mPendingRegionInfos (#4713)
1 parent 36b5258 commit 254fa66

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

Framework/Core/src/DataProcessingDevice.cxx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -451,11 +451,14 @@ bool DataProcessingDevice::ConditionalRun()
451451

452452
// Notify on the main thread the new region callbacks, making sure
453453
// no callback is issued if there is something still processing.
454-
if (mPendingRegionInfos.empty() == false) {
455-
std::vector<FairMQRegionInfo> toBeNotified;
456-
toBeNotified.swap(mPendingRegionInfos); // avoid any MT issue.
457-
for (auto const& info : toBeNotified) {
458-
mServiceRegistry.get<CallbackService>()(CallbackService::Id::RegionInfoCallback, info);
454+
{
455+
std::lock_guard<std::mutex> lock(mRegionInfoMutex);
456+
if (mPendingRegionInfos.empty() == false) {
457+
std::vector<FairMQRegionInfo> toBeNotified;
458+
toBeNotified.swap(mPendingRegionInfos); // avoid any MT issue.
459+
for (auto const& info : toBeNotified) {
460+
mServiceRegistry.get<CallbackService>()(CallbackService::Id::RegionInfoCallback, info);
461+
}
459462
}
460463
}
461464
// Synchronous execution of the callbacks. This will be moved in the

0 commit comments

Comments
 (0)