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

Unified Diff: runtime/vm/os_thread_fuchsia.cc

Issue 2916313003: [Fuchsia] Enable CPU profiling for the standalone VM (Closed)
Patch Set: Poll until suspended 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
Index: runtime/vm/os_thread_fuchsia.cc
diff --git a/runtime/vm/os_thread_fuchsia.cc b/runtime/vm/os_thread_fuchsia.cc
index e4f7bba30285eae91162ff3bf20560d0a9e776f2..5b236b9a6be5a5f0a3663c7ff0f3c23ba3286d7f 100644
--- a/runtime/vm/os_thread_fuchsia.cc
+++ b/runtime/vm/os_thread_fuchsia.cc
@@ -5,10 +5,12 @@
#include "platform/globals.h" // NOLINT
#if defined(HOST_OS_FUCHSIA)
+#include "vm/os.h"
#include "vm/os_thread.h"
#include "vm/os_thread_fuchsia.h"
#include <errno.h> // NOLINT
+#include <magenta/status.h>
#include <magenta/syscalls.h>
#include <magenta/syscalls/object.h>
#include <magenta/threads.h>
@@ -163,7 +165,10 @@ ThreadId OSThread::GetCurrentThreadId() {
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;
+ if (status != NO_ERROR) {
+ FATAL1("Failed to get thread koid: %s\n", mx_status_get_string(status));
+ }
+ return info.koid;
}
@@ -398,7 +403,12 @@ Monitor::WaitResult Monitor::WaitMicros(int64_t micros) {
Monitor::WaitResult retval = kNotified;
if (micros == kNoTimeout) {
// Wait forever.
- int result = pthread_cond_wait(data_.cond(), data_.mutex());
+ int result;
+ do {
+ result = pthread_cond_wait(data_.cond(), data_.mutex());
+ // TODO(MG-795): Disallow ETIMEDOUT when pthread_cond_wait() can no longer
+ // return it.
+ } while (result == ETIMEDOUT);
VALIDATE_PTHREAD_RESULT(result);
} else {
struct timespec ts;

Powered by Google App Engine
This is Rietveld 408576698