History log of /llvm-project/lldb/test/API/api/multithreaded/deep_stack.cpp (Results 1 – 1 of 1)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6
# 186fac33 12-Dec-2024 jimingham <jingham@apple.com>

Convert the StackFrameList mutex to a shared mutex. (#117252)

In fact, there's only one public API in StackFrameList that changes
the list explicitly. The rest only change the list if you happen

Convert the StackFrameList mutex to a shared mutex. (#117252)

In fact, there's only one public API in StackFrameList that changes
the list explicitly. The rest only change the list if you happen to
ask for more frames than lldb has currently fetched and that
always adds frames "behind the user's back". So we were
much more prone to deadlocking than we needed to be.

This patch uses a shared_mutex instead, and when we have to add more
frames (in GetFramesUpTo) we switches to exclusive long enough to add
the frames, then goes back to shared.

Most of the work here was actually getting the stack frame list locking
to not
require a recursive mutex (shared mutexes aren't recursive).

I also added a test that has 5 threads progressively asking for more
frames simultaneously to make sure we get back valid frames and don't
deadlock.

show more ...