| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/globals.h" // NOLINT | 5 #include "platform/globals.h" // NOLINT |
| 6 #if defined(HOST_OS_FUCHSIA) | 6 #if defined(HOST_OS_FUCHSIA) |
| 7 | 7 |
| 8 #include "vm/os.h" |
| 8 #include "vm/os_thread.h" | 9 #include "vm/os_thread.h" |
| 9 #include "vm/os_thread_fuchsia.h" | 10 #include "vm/os_thread_fuchsia.h" |
| 10 | 11 |
| 11 #include <errno.h> // NOLINT | 12 #include <errno.h> // NOLINT |
| 13 #include <magenta/status.h> |
| 12 #include <magenta/syscalls.h> | 14 #include <magenta/syscalls.h> |
| 13 #include <magenta/syscalls/object.h> | 15 #include <magenta/syscalls/object.h> |
| 14 #include <magenta/threads.h> | 16 #include <magenta/threads.h> |
| 15 #include <magenta/types.h> | 17 #include <magenta/types.h> |
| 16 | 18 |
| 17 #include "platform/assert.h" | 19 #include "platform/assert.h" |
| 18 | 20 |
| 19 namespace dart { | 21 namespace dart { |
| 20 | 22 |
| 21 #define VALIDATE_PTHREAD_RESULT(result) \ | 23 #define VALIDATE_PTHREAD_RESULT(result) \ |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 return kStackSize; | 158 return kStackSize; |
| 157 } | 159 } |
| 158 | 160 |
| 159 | 161 |
| 160 ThreadId OSThread::GetCurrentThreadId() { | 162 ThreadId OSThread::GetCurrentThreadId() { |
| 161 mx_info_handle_basic_t info; | 163 mx_info_handle_basic_t info; |
| 162 mx_handle_t thread_handle = thrd_get_mx_handle(thrd_current()); | 164 mx_handle_t thread_handle = thrd_get_mx_handle(thrd_current()); |
| 163 mx_status_t status = | 165 mx_status_t status = |
| 164 mx_object_get_info(thread_handle, MX_INFO_HANDLE_BASIC, &info, | 166 mx_object_get_info(thread_handle, MX_INFO_HANDLE_BASIC, &info, |
| 165 sizeof(info), nullptr, nullptr); | 167 sizeof(info), nullptr, nullptr); |
| 166 return status == NO_ERROR ? info.koid : MX_KOID_INVALID; | 168 if (status != NO_ERROR) { |
| 169 FATAL1("Failed to get thread koid: %s\n", mx_status_get_string(status)); |
| 170 } |
| 171 return info.koid; |
| 167 } | 172 } |
| 168 | 173 |
| 169 | 174 |
| 170 #ifndef PRODUCT | 175 #ifndef PRODUCT |
| 171 ThreadId OSThread::GetCurrentThreadTraceId() { | 176 ThreadId OSThread::GetCurrentThreadTraceId() { |
| 172 return pthread_self(); | 177 return pthread_self(); |
| 173 } | 178 } |
| 174 #endif // PRODUCT | 179 #endif // PRODUCT |
| 175 | 180 |
| 176 | 181 |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 void Monitor::NotifyAll() { | 436 void Monitor::NotifyAll() { |
| 432 // When running with assertions enabled we track the owner. | 437 // When running with assertions enabled we track the owner. |
| 433 ASSERT(IsOwnedByCurrentThread()); | 438 ASSERT(IsOwnedByCurrentThread()); |
| 434 int result = pthread_cond_broadcast(data_.cond()); | 439 int result = pthread_cond_broadcast(data_.cond()); |
| 435 VALIDATE_PTHREAD_RESULT(result); | 440 VALIDATE_PTHREAD_RESULT(result); |
| 436 } | 441 } |
| 437 | 442 |
| 438 } // namespace dart | 443 } // namespace dart |
| 439 | 444 |
| 440 #endif // defined(HOST_OS_FUCHSIA) | 445 #endif // defined(HOST_OS_FUCHSIA) |
| OLD | NEW |