When process, that debugserver is attached to, exits, there is a race condition
if the process STDIO will be consumed and appened to internal stdio buffer before
debugserver flushes the stdio buffer for the last time and sends process exit status to lldb.
This patch adds the ability to signal the stdio thread to stop and wait for it to finish and
uses this to wait for the thread to finish before flushing output for the last time.
This is a potential patch for https://bugs.llvm.org/show_bug.cgi?id=45454
To reliably reproduce the problem I added usleep(1000) in MachProcess::STDIOThread before calls to AppendSTDOUT.