Re-land "[lldb] Synchronize output through the IOHandler"
authorJonas Devlieghere <jonas@devlieghere.com>
Tue, 15 Mar 2022 18:11:04 +0000 (11:11 -0700)
committerJonas Devlieghere <jonas@devlieghere.com>
Tue, 15 Mar 2022 19:53:46 +0000 (12:53 -0700)
commit8e776bb660dda6c51ce7ca6cea641db1f47aa9cf
tree462f6049b2bc1aa315b744743954810c00cd44ee
parent57f03db1953d81b0868d4c19ab30c93f5e90b3d3
Re-land "[lldb] Synchronize output through the IOHandler"

Add synchronization to the IOHandler to prevent multiple threads from
writing concurrently to the output or error stream.

A scenario where this could happen is when a thread (the default event
thread for example) is using the debugger's asynchronous stream. We
would delegate this operation to the IOHandler which might be running on
another thread. Until this patch there was nothing to synchronize the
two at the IOHandler level.

Differential revision: https://reviews.llvm.org/D121500
lldb/include/lldb/Core/IOHandler.h
lldb/include/lldb/Host/Editline.h
lldb/include/lldb/Interpreter/CommandInterpreter.h
lldb/source/Core/IOHandler.cpp
lldb/source/Host/common/Editline.cpp
lldb/source/Interpreter/CommandInterpreter.cpp
lldb/unittests/Editline/EditlineTest.cpp