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

Eugene Zhulenev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 26 07:34:55 PDT 2021


ezhulenev updated this revision to Diff 354680.
ezhulenev added a comment.

Update


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.354680.patch
Type: text/x-patch
Size: 449 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210626/50e5d39b/attachment.bin>


More information about the llvm-commits mailing list