Patch that allows for thread_t to be something more complex than an
integer. Modified patch from Kirk Beitz.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@125067 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp b/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp
index cfcd7f9..f2e906e 100644
--- a/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp
+++ b/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp
@@ -1167,7 +1167,7 @@
         m_exception_messages.clear();
     }
 
-    if (m_monitor_thread != LLDB_INVALID_HOST_THREAD)
+    if (IS_VALID_LLDB_HOST_THREAD(m_monitor_thread))
     {
         Host::ThreadCancel (m_monitor_thread, NULL);
         thread_result_t thread_result;
@@ -1180,6 +1180,9 @@
 bool
 ProcessMacOSX::StartSTDIOThread()
 {
+    if (IS_VALID_LLDB_HOST_THREAD(m_stdio_thread))
+        return true;
+
     // If we created and own the child STDIO file handles, then we track the
     // STDIO ourselves, else we let whomever owns these file handles track
     // the IO themselves.
@@ -1188,7 +1191,7 @@
         ProcessMacOSXLog::LogIf (PD_LOG_PROCESS, "ProcessMacOSX::%s ( )", __FUNCTION__);
         // Create the thread that watches for the child STDIO
         m_stdio_thread = Host::ThreadCreate ("<lldb.process.process-macosx.stdio>", ProcessMacOSX::STDIOThread, this, NULL);
-        return m_stdio_thread != LLDB_INVALID_HOST_THREAD;
+        return IS_VALID_LLDB_HOST_THREAD(m_stdio_thread);
     }
     return false;
 }
@@ -1199,7 +1202,7 @@
 {
     ProcessMacOSXLog::LogIf (PD_LOG_PROCESS, "ProcessMacOSX::%s ( )", __FUNCTION__);
     // Stop the stdio thread
-    if (m_stdio_thread != LLDB_INVALID_HOST_THREAD)
+    if (IS_VALID_LLDB_HOST_THREAD(m_stdio_thread))
     {
         Host::ThreadCancel (m_stdio_thread, NULL);
         thread_result_t result = NULL;
diff --git a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 41296d9..50fa200 100644
--- a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -131,7 +131,7 @@
 {
     m_dynamic_loader_ap.reset();
 
-    if (m_debugserver_thread != LLDB_INVALID_HOST_THREAD)
+    if (IS_VALID_LLDB_HOST_THREAD(m_debugserver_thread))
     {
         Host::ThreadCancel (m_debugserver_thread, NULL);
         thread_result_t thread_result;
@@ -2174,7 +2174,7 @@
     // Create a thread that watches our internal state and controls which
     // events make it to clients (into the DCProcess event queue).
     m_async_thread = Host::ThreadCreate ("<lldb.process.gdb-remote.async>", ProcessGDBRemote::AsyncThread, this, NULL);
-    return m_async_thread != LLDB_INVALID_HOST_THREAD;
+    return IS_VALID_LLDB_HOST_THREAD(m_async_thread);
 }
 
 void
@@ -2188,7 +2188,7 @@
     m_async_broadcaster.BroadcastEvent (eBroadcastBitAsyncThreadShouldExit);
 
     // Stop the stdio thread
-    if (m_async_thread != LLDB_INVALID_HOST_THREAD)
+    if (IS_VALID_LLDB_HOST_THREAD(m_async_thread))
     {
         Host::ThreadJoin (m_async_thread, NULL, NULL);
     }