| 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" | 5 #include "platform/globals.h" |
| 6 #if defined(TARGET_OS_FUCHSIA) | 6 #if defined(TARGET_OS_FUCHSIA) |
| 7 | 7 |
| 8 #include "bin/thread.h" | 8 #include "bin/thread.h" |
| 9 #include "bin/thread_fuchsia.h" | 9 #include "bin/thread_fuchsia.h" |
| 10 | 10 |
| 11 #include <errno.h> // NOLINT | 11 #include <errno.h> // NOLINT |
| 12 #include <sys/resource.h> // NOLINT | 12 #include <sys/resource.h> // NOLINT |
| 13 #include <sys/time.h> // NOLINT | 13 #include <sys/time.h> // NOLINT |
| 14 | 14 |
| 15 #include "platform/assert.h" | 15 #include "platform/assert.h" |
| 16 #include "platform/utils.h" | 16 #include "platform/utils.h" |
| 17 | 17 |
| 18 namespace dart { | 18 namespace dart { |
| 19 namespace bin { | 19 namespace bin { |
| 20 | 20 |
| 21 #define VALIDATE_PTHREAD_RESULT(result) \ | 21 #define VALIDATE_PTHREAD_RESULT(result) \ |
| 22 if (result != 0) { \ | 22 if (result != 0) { \ |
| 23 const int kBufferSize = 1024; \ | 23 const int kBufferSize = 1024; \ |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 ASSERT(sizeof(id) == sizeof(intptr_t)); | 158 ASSERT(sizeof(id) == sizeof(intptr_t)); |
| 159 return static_cast<intptr_t>(id); | 159 return static_cast<intptr_t>(id); |
| 160 } | 160 } |
| 161 | 161 |
| 162 | 162 |
| 163 bool Thread::Compare(ThreadId a, ThreadId b) { | 163 bool Thread::Compare(ThreadId a, ThreadId b) { |
| 164 return (pthread_equal(a, b) != 0); | 164 return (pthread_equal(a, b) != 0); |
| 165 } | 165 } |
| 166 | 166 |
| 167 | 167 |
| 168 void Thread::GetThreadCpuUsage(ThreadId thread_id, int64_t* cpu_usage) { | |
| 169 UNIMPLEMENTED(); | |
| 170 } | |
| 171 | |
| 172 | |
| 173 void Thread::InitOnce() { | 168 void Thread::InitOnce() { |
| 174 // Nothing to be done. | 169 // Nothing to be done. |
| 175 } | 170 } |
| 176 | 171 |
| 177 | 172 |
| 178 Mutex::Mutex() { | 173 Mutex::Mutex() { |
| 179 pthread_mutexattr_t attr; | 174 pthread_mutexattr_t attr; |
| 180 int result = pthread_mutexattr_init(&attr); | 175 int result = pthread_mutexattr_init(&attr); |
| 181 VALIDATE_PTHREAD_RESULT(result); | 176 VALIDATE_PTHREAD_RESULT(result); |
| 182 | 177 |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 void Monitor::NotifyAll() { | 315 void Monitor::NotifyAll() { |
| 321 // TODO(iposva): Do we need to track lock owners? | 316 // TODO(iposva): Do we need to track lock owners? |
| 322 int result = pthread_cond_broadcast(data_.cond()); | 317 int result = pthread_cond_broadcast(data_.cond()); |
| 323 VALIDATE_PTHREAD_RESULT(result); | 318 VALIDATE_PTHREAD_RESULT(result); |
| 324 } | 319 } |
| 325 | 320 |
| 326 } // namespace bin | 321 } // namespace bin |
| 327 } // namespace dart | 322 } // namespace dart |
| 328 | 323 |
| 329 #endif // defined(TARGET_OS_FUCHSIA) | 324 #endif // defined(TARGET_OS_FUCHSIA) |
| OLD | NEW |