AllErr = joinErrors(std::move(AllErr), std::move(Err));
}
+ // Remove the allocation from the allocation list of its reservation
+ for (auto &Reservation : Reservations) {
+ auto AllocationIt =
+ std::find(Reservation.second.Allocations.begin(),
+ Reservation.second.Allocations.end(), Base);
+ if (AllocationIt != Reservation.second.Allocations.end()) {
+ Reservation.second.Allocations.erase(AllocationIt);
+ break;
+ }
+ }
+
Allocations.erase(Base);
}
}
}
Error ExecutorSharedMemoryMapperService::shutdown() {
- std::vector<ExecutorAddr> ReservationAddrs;
- {
- std::lock_guard<std::mutex> Lock(Mutex);
+ if (Reservations.empty())
+ return Error::success();
- if (Reservations.empty())
- return Error::success();
-
- ReservationAddrs.reserve(Reservations.size());
- for (const auto &R : Reservations) {
- ReservationAddrs.push_back(ExecutorAddr::fromPtr(R.getFirst()));
- }
-
- Reservations.clear();
- }
+ std::vector<ExecutorAddr> ReservationAddrs;
+ ReservationAddrs.reserve(Reservations.size());
+ for (const auto &R : Reservations)
+ ReservationAddrs.push_back(ExecutorAddr::fromPtr(R.getFirst()));
- return release(ReservationAddrs);
+ return release(std::move(ReservationAddrs));
}
void ExecutorSharedMemoryMapperService::addBootstrapSymbols(