summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/tools/lldb/source/Host/posix/HostThreadPosix.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/tools/lldb/source/Host/posix/HostThreadPosix.cpp')
-rw-r--r--contrib/llvm/tools/lldb/source/Host/posix/HostThreadPosix.cpp74
1 files changed, 74 insertions, 0 deletions
diff --git a/contrib/llvm/tools/lldb/source/Host/posix/HostThreadPosix.cpp b/contrib/llvm/tools/lldb/source/Host/posix/HostThreadPosix.cpp
new file mode 100644
index 0000000..9c48924
--- /dev/null
+++ b/contrib/llvm/tools/lldb/source/Host/posix/HostThreadPosix.cpp
@@ -0,0 +1,74 @@
+//===-- HostThreadPosix.cpp -------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/Core/Error.h"
+#include "lldb/Host/posix/HostThreadPosix.h"
+
+#include <errno.h>
+#include <pthread.h>
+
+using namespace lldb;
+using namespace lldb_private;
+
+HostThreadPosix::HostThreadPosix()
+{
+}
+
+HostThreadPosix::HostThreadPosix(lldb::thread_t thread)
+ : HostNativeThreadBase(thread)
+{
+}
+
+HostThreadPosix::~HostThreadPosix()
+{
+}
+
+Error
+HostThreadPosix::Join(lldb::thread_result_t *result)
+{
+ Error error;
+ if (IsJoinable())
+ {
+ int err = ::pthread_join(m_thread, result);
+ error.SetError(err, lldb::eErrorTypePOSIX);
+ }
+ else
+ {
+ if (result)
+ *result = NULL;
+ error.SetError(EINVAL, eErrorTypePOSIX);
+ }
+
+ Reset();
+ return error;
+}
+
+Error
+HostThreadPosix::Cancel()
+{
+ Error error;
+#ifndef __ANDROID__
+ int err = ::pthread_cancel(m_thread);
+ error.SetError(err, eErrorTypePOSIX);
+#else
+ error.SetErrorString("HostThreadPosix::Cancel() not supported on Android");
+#endif
+
+ return error;
+}
+
+Error
+HostThreadPosix::Detach()
+{
+ Error error;
+ int err = ::pthread_detach(m_thread);
+ error.SetError(err, eErrorTypePOSIX);
+ Reset();
+ return error;
+}
OpenPOWER on IntegriCloud