Skip to content

Commit 59e80e3

Browse files
committed
[lldb] Fix deadlock between statusline and output mutex
Fix a deadlock between the statusline mutex (in Debugger) and the output file mutex (in LockedStreamFile). The deadlock occurs when the main thread is calling the statusline callback while holding the output mutex in Editline, while the default event thread is trying to update the stausline. rdar://149251156
1 parent 95d526f commit 59e80e3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lldb/source/Host/common/Editline.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,8 +567,11 @@ int Editline::GetCharacter(EditLineGetCharType *c) {
567567
m_needs_prompt_repaint = false;
568568
}
569569

570-
if (m_redraw_callback)
570+
if (m_redraw_callback) {
571+
m_locked_output.reset();
571572
m_redraw_callback();
573+
m_locked_output.emplace(m_output_stream_sp->Lock());
574+
}
572575

573576
if (m_multiline_enabled) {
574577
// Detect when the number of rows used for this input line changes due to

0 commit comments

Comments
 (0)