diff options
Diffstat (limited to 'lldb/source/Host/posix/HostThreadPosix.cpp')
-rw-r--r-- | lldb/source/Host/posix/HostThreadPosix.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/lldb/source/Host/posix/HostThreadPosix.cpp b/lldb/source/Host/posix/HostThreadPosix.cpp index 9c489243193..3ac83ac07b1 100644 --- a/lldb/source/Host/posix/HostThreadPosix.cpp +++ b/lldb/source/Host/posix/HostThreadPosix.cpp @@ -53,13 +53,16 @@ Error HostThreadPosix::Cancel() { Error error; + if (IsJoinable()) + { #ifndef __ANDROID__ - int err = ::pthread_cancel(m_thread); - error.SetError(err, eErrorTypePOSIX); + assert(false && "someone is calling HostThread::Cancel()"); + int err = ::pthread_cancel(m_thread); + error.SetError(err, eErrorTypePOSIX); #else - error.SetErrorString("HostThreadPosix::Cancel() not supported on Android"); + error.SetErrorString("HostThreadPosix::Cancel() not supported on Android"); #endif - + } return error; } @@ -67,8 +70,11 @@ Error HostThreadPosix::Detach() { Error error; - int err = ::pthread_detach(m_thread); - error.SetError(err, eErrorTypePOSIX); + if (IsJoinable()) + { + int err = ::pthread_detach(m_thread); + error.SetError(err, eErrorTypePOSIX); + } Reset(); return error; } |