This is an archive of the discontinued LLVM Phabricator instance.

[llvm] Protect signpost map with a mutex
ClosedPublic

Authored by JDevlieghere on Jan 7 2021, 9:10 PM.

Details

Summary

Use a mutex to protect concurrent access to the signpost map.

This fixes nondeterministic crashes in LLDB that appeared after using signposts in the timer implementation.

Diff Detail

Event Timeline

JDevlieghere created this revision.Jan 7 2021, 9:10 PM
JDevlieghere requested review of this revision.Jan 7 2021, 9:10 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 7 2021, 9:10 PM

A sys::SmartMutex equivalent of this would LGTM. Let me know if there's a reason we should stick to std::mutex

llvm/lib/Support/Signposts.cpp
42

Timer.cpp uses sys::SmartMutex so that single threaded builds don't have to do the mutex. We should do the same here unless there's a good reason to use std::mutex

Use SmartMutex and SmartScopedLock.

JDevlieghere marked an inline comment as done.Jan 19 2021, 8:41 AM
JDevlieghere added inline comments.
llvm/lib/Support/Signposts.cpp
42

Makes sense, thanks, I've updated the patch.

This revision is now accepted and ready to land.Jan 19 2021, 11:19 AM
This revision was automatically updated to reflect the committed changes.
JDevlieghere marked an inline comment as done.