[PATCH] D104977: [perf] Fix a data race in the PerfJITEventListener

Eugene Zhulenev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 29 08:30:46 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe88ac7295fa2: [perf] Fix a data race in the PerfJITEventListener (authored by ezhulenev).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104977/new/

https://reviews.llvm.org/D104977

Files:
  llvm/lib/ExecutionEngine/PerfJITEvents/PerfJITEventListener.cpp


Index: llvm/lib/ExecutionEngine/PerfJITEvents/PerfJITEventListener.cpp
===================================================================
--- llvm/lib/ExecutionEngine/PerfJITEvents/PerfJITEventListener.cpp
+++ llvm/lib/ExecutionEngine/PerfJITEvents/PerfJITEventListener.cpp
@@ -284,6 +284,9 @@
     NotifyCode(Name, *AddrOrErr, Size);
   }
 
+  // avoid races with writes
+  std::lock_guard<sys::Mutex> Guard(Mutex);
+
   Dumpstream->flush();
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104977.355257.patch
Type: text/x-patch
Size: 449 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210629/56d0c03c/attachment.bin>


More information about the llvm-commits mailing list