Index: runtime/vm/os_thread_fuchsia.cc |
diff --git a/runtime/vm/os_thread_fuchsia.cc b/runtime/vm/os_thread_fuchsia.cc |
index 20db34d097eb4571f9ac49f0f55087694447497c..e4f7bba30285eae91162ff3bf20560d0a9e776f2 100644 |
--- a/runtime/vm/os_thread_fuchsia.cc |
+++ b/runtime/vm/os_thread_fuchsia.cc |
@@ -10,6 +10,8 @@ |
#include <errno.h> // NOLINT |
#include <magenta/syscalls.h> |
+#include <magenta/syscalls/object.h> |
+#include <magenta/threads.h> |
#include <magenta/types.h> |
#include "platform/assert.h" |
@@ -121,7 +123,7 @@ int OSThread::Start(const char* name, |
} |
-const ThreadId OSThread::kInvalidThreadId = static_cast<ThreadId>(0); |
+const ThreadId OSThread::kInvalidThreadId = MX_KOID_INVALID; |
const ThreadJoinId OSThread::kInvalidThreadJoinId = |
static_cast<ThreadJoinId>(0); |
@@ -156,7 +158,12 @@ intptr_t OSThread::GetMaxStackSize() { |
ThreadId OSThread::GetCurrentThreadId() { |
- return pthread_self(); |
+ mx_info_handle_basic_t info; |
+ mx_handle_t thread_handle = thrd_get_mx_handle(thrd_current()); |
+ mx_status_t status = |
+ mx_object_get_info(thread_handle, MX_INFO_HANDLE_BASIC, &info, |
+ sizeof(info), nullptr, nullptr); |
+ return status == NO_ERROR ? info.koid : MX_KOID_INVALID; |
} |