<rdar://problem/13259230>
authorHan Ming Ong <hanming@apple.com>
Thu, 21 Feb 2013 16:31:31 +0000 (16:31 +0000)
committerHan Ming Ong <hanming@apple.com>
Thu, 21 Feb 2013 16:31:31 +0000 (16:31 +0000)
Remember to set m_profile_thread to NULL once the profile thread is turned off.

llvm-svn: 175761

lldb/tools/debugserver/source/MacOSX/MachProcess.cpp

index 67674ec..0bf69fe 100644 (file)
@@ -313,10 +313,15 @@ MachProcess::SetEnableAsyncProfiling(bool enable, uint64_t interval_usec)
     m_profile_enabled = enable;
     m_profile_interval_usec = interval_usec;
     
-    if (m_profile_enabled && (m_profile_thread == 0))
+    if (m_profile_enabled && (m_profile_thread == NULL))
     {
         StartProfileThread();
     }
+    else if (!m_profile_enabled && m_profile_thread)
+    {
+        pthread_join(m_profile_thread, NULL);
+        m_profile_thread = NULL;
+    }
 }
 
 bool