mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-23 01:20:03 +00:00
[lldb] Add parts accidentally left out of 769d704: Recommit "[lldb/Core] Fix a race in the Communication class"
I went to a great length to explain the reason why these changes were needed, but I did not actually ammend the patch to include them. :(
This commit is contained in:
parent
db91a6b800
commit
a9406daaa6
@ -362,10 +362,17 @@ lldb::thread_result_t Communication::ReadThread(lldb::thread_arg_t p) {
|
||||
if (log)
|
||||
LLDB_LOGF(log, "%p Communication::ReadThread () thread exiting...", p);
|
||||
|
||||
comm->BroadcastEvent(eBroadcastBitNoMorePendingInput);
|
||||
// Handle threads wishing to synchronize with us.
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(comm->m_synchronize_mutex);
|
||||
// Prevent new ones from showing up.
|
||||
comm->m_read_thread_did_exit = true;
|
||||
|
||||
// Unblock any existing thread waiting for the synchronization signal.
|
||||
comm->BroadcastEvent(eBroadcastBitNoMorePendingInput);
|
||||
|
||||
// Wait for the thread to finish...
|
||||
std::lock_guard<std::mutex> guard(comm->m_synchronize_mutex);
|
||||
// ... and disconnect.
|
||||
if (disconnect)
|
||||
comm->Disconnect();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user