Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(931)

Unified Diff: runtime/vm/os_thread_fuchsia.cc

Issue 2796143002: [Fuchsia] Implements the thread interrupter for CPU profiling. (Closed)
Patch Set: Format Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/os_thread_fuchsia.h ('k') | runtime/vm/thread_interrupter_fuchsia.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « runtime/vm/os_thread_fuchsia.h ('k') | runtime/vm/thread_interrupter_fuchsia.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698