[lldb] Synchronize output through the IOHandler
authorJonas Devlieghere <jonas@devlieghere.com>
Tue, 15 Mar 2022 16:13:57 +0000 (09:13 -0700)
committerJonas Devlieghere <jonas@devlieghere.com>
Tue, 15 Mar 2022 16:32:56 +0000 (09:32 -0700)
commit242c574dc03e4b90e992cc8d07436efc3954727f
treeaac74cdfb438936192c1c03007e1d0c4d2b562ec
parenta6ec1e3d798f8eab43fb3a91028c6ab04e115fcb
[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