[PATCH] D134212: [Orc] Fix the SharedMemoryMapper dtor

Alexandre Ganea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 19 12:46:28 PDT 2022


aganea created this revision.
aganea added reviewers: argentite, lhames.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
aganea requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

As briefly discussed on rG1134d3a03fac <https://reviews.llvm.org/rG1134d3a03facccd75efc5385ba46918bef94fcb6>, fix the unintended copy while iterating on `Reservations` and add a mutex guard, to be symmetric with other usages of `Reservations`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134212

Files:
  llvm/lib/ExecutionEngine/Orc/MemoryMapper.cpp


Index: llvm/lib/ExecutionEngine/Orc/MemoryMapper.cpp
===================================================================
--- llvm/lib/ExecutionEngine/Orc/MemoryMapper.cpp
+++ llvm/lib/ExecutionEngine/Orc/MemoryMapper.cpp
@@ -411,7 +411,8 @@
 }
 
 SharedMemoryMapper::~SharedMemoryMapper() {
-  for (const auto R : Reservations) {
+  std::lock_guard<std::mutex> Lock(Mutex);
+  for (const auto &R : Reservations) {
 
 #if defined(LLVM_ON_UNIX) && !defined(__ANDROID__)
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134212.461314.patch
Type: text/x-patch
Size: 470 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220919/79afdd52/attachment.bin>


More information about the llvm-commits mailing list