[Lldb-commits] [lldb] r235291 - Stop read thread of Communication on EOF

Tamas Berghammer tberghammer at google.com
Mon Apr 20 02:52:48 PDT 2015


Author: tberghammer
Date: Mon Apr 20 04:52:47 2015
New Revision: 235291

URL: http://llvm.org/viewvc/llvm-project?rev=235291&view=rev
Log:
Stop read thread of Communication on EOF

Previously the read thread was only stopped if CloseOnEOF was set on the
communication channel. It caused it to spin in case of an EOF because
::select() always reported that we can read from the file descriptor.
This CL change this behavior with stopping the read thread on EOF but do
a disconnect only if CloseOnEOF is enabled.

Differential revision: http://reviews.llvm.org/D9077

Modified:
    lldb/trunk/source/Core/Communication.cpp

Modified: lldb/trunk/source/Core/Communication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Communication.cpp?rev=235291&r1=235290&r2=235291&view=diff
==============================================================================
--- lldb/trunk/source/Core/Communication.cpp (original)
+++ lldb/trunk/source/Core/Communication.cpp Mon Apr 20 04:52:47 2015
@@ -184,7 +184,8 @@ Communication::Read (void *dst, size_t d
 
             if (event_type & eBroadcastBitReadThreadDidExit)
             {
-                Disconnect (NULL);
+                if (GetCloseOnEOF ())
+                    Disconnect (NULL);
                 break;
             }
         }
@@ -379,9 +380,8 @@ Communication::ReadThread (lldb::thread_
             break;
 
         case eConnectionStatusEndOfFile:
-            if (comm->GetCloseOnEOF())
-                 done = true;
-             break;
+            done = true;
+            break;
         case eConnectionStatusError:            // Check GetError() for details
             if (error.GetType() == eErrorTypePOSIX && error.GetError() == EIO)
             {





More information about the lldb-commits mailing list