Skip to content

Commit b424b0b

Browse files
committed
[lldb/Target] Avoid race between Communication::Disconnect calls.
Avoid a race between the Disconnect call in `Communication::ReadThread` and the one in `Process::ShouldBroadcastEvent` by reordering the calls to Disconnect and StopReadThread in `Process::ShouldBroadcastEvent`. In D77295 Pavel suggested that that might explain the broken pipe I was seeing. Indeed, changing the order resolved the issue.
1 parent 478619c commit b424b0b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lldb/source/Target/Process.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3386,8 +3386,8 @@ bool Process::ShouldBroadcastEvent(Event *event_ptr) {
33863386
case eStateExited:
33873387
case eStateUnloaded:
33883388
m_stdio_communication.SynchronizeWithReadThread();
3389-
m_stdio_communication.Disconnect();
33903389
m_stdio_communication.StopReadThread();
3390+
m_stdio_communication.Disconnect();
33913391
m_stdin_forward = false;
33923392

33933393
LLVM_FALLTHROUGH;

0 commit comments

Comments
 (0)