| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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(TARGET_OS_ANDROID) | 6 #if defined(TARGET_OS_ANDROID) |
| 7 | 7 |
| 8 #include "vm/os_thread.h" | 8 #include "vm/os_thread.h" |
| 9 | 9 |
| 10 #include <errno.h> // NOLINT | 10 #include <errno.h> // NOLINT |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 return false; | 162 return false; |
| 163 } | 163 } |
| 164 | 164 |
| 165 | 165 |
| 166 intptr_t OSThread::ThreadIdToIntPtr(ThreadId id) { | 166 intptr_t OSThread::ThreadIdToIntPtr(ThreadId id) { |
| 167 ASSERT(sizeof(id) == sizeof(intptr_t)); | 167 ASSERT(sizeof(id) == sizeof(intptr_t)); |
| 168 return static_cast<intptr_t>(id); | 168 return static_cast<intptr_t>(id); |
| 169 } | 169 } |
| 170 | 170 |
| 171 | 171 |
| 172 ThreadId OSThread::ThreadIdFromIntPtr(intptr_t id) { |
| 173 return static_cast<ThreadId>(id); |
| 174 } |
| 175 |
| 176 |
| 172 bool OSThread::Compare(ThreadId a, ThreadId b) { | 177 bool OSThread::Compare(ThreadId a, ThreadId b) { |
| 173 return a == b; | 178 return a == b; |
| 174 } | 179 } |
| 175 | 180 |
| 176 | 181 |
| 177 void OSThread::GetThreadCpuUsage(ThreadId thread_id, int64_t* cpu_usage) { | 182 void OSThread::GetThreadCpuUsage(ThreadId thread_id, int64_t* cpu_usage) { |
| 178 ASSERT(thread_id == GetCurrentThreadId()); | 183 ASSERT(thread_id == GetCurrentThreadId()); |
| 179 ASSERT(cpu_usage != NULL); | 184 ASSERT(cpu_usage != NULL); |
| 180 struct timespec ts; | 185 struct timespec ts; |
| 181 int r = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts); | 186 int r = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 | 351 |
| 347 void Monitor::NotifyAll() { | 352 void Monitor::NotifyAll() { |
| 348 // TODO(iposva): Do we need to track lock owners? | 353 // TODO(iposva): Do we need to track lock owners? |
| 349 int result = pthread_cond_broadcast(data_.cond()); | 354 int result = pthread_cond_broadcast(data_.cond()); |
| 350 VALIDATE_PTHREAD_RESULT(result); | 355 VALIDATE_PTHREAD_RESULT(result); |
| 351 } | 356 } |
| 352 | 357 |
| 353 } // namespace dart | 358 } // namespace dart |
| 354 | 359 |
| 355 #endif // defined(TARGET_OS_ANDROID) | 360 #endif // defined(TARGET_OS_ANDROID) |
| OLD | NEW |