diff --git a/lib/ExecutionEngine/PerfJITEvents/PerfJITEventListener.cpp b/lib/ExecutionEngine/PerfJITEvents/PerfJITEventListener.cpp index d4c715cc59f..4a236e183c8 100644 --- a/lib/ExecutionEngine/PerfJITEvents/PerfJITEventListener.cpp +++ b/lib/ExecutionEngine/PerfJITEvents/PerfJITEventListener.cpp @@ -284,6 +284,9 @@ void PerfJITEventListener::notifyObjectLoaded( NotifyCode(Name, *AddrOrErr, Size); } + // avoid races with writes + std::lock_guard Guard(Mutex); + Dumpstream->flush(); }