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_MACOS) | 6 #if defined(TARGET_OS_MACOS) |
7 | 7 |
8 #include "vm/os_thread.h" | 8 #include "vm/os_thread.h" |
9 | 9 |
10 #include <sys/errno.h> // NOLINT | 10 #include <sys/errno.h> // NOLINT |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 return false; | 155 return false; |
156 } | 156 } |
157 | 157 |
158 | 158 |
159 intptr_t OSThread::ThreadIdToIntPtr(ThreadId id) { | 159 intptr_t OSThread::ThreadIdToIntPtr(ThreadId id) { |
160 ASSERT(sizeof(id) == sizeof(intptr_t)); | 160 ASSERT(sizeof(id) == sizeof(intptr_t)); |
161 return reinterpret_cast<intptr_t>(id); | 161 return reinterpret_cast<intptr_t>(id); |
162 } | 162 } |
163 | 163 |
164 | 164 |
| 165 ThreadId OSThread::ThreadIdFromIntPtr(intptr_t id) { |
| 166 return reinterpret_cast<ThreadId>(id); |
| 167 } |
| 168 |
| 169 |
165 bool OSThread::Compare(ThreadId a, ThreadId b) { | 170 bool OSThread::Compare(ThreadId a, ThreadId b) { |
166 return pthread_equal(a, b) != 0; | 171 return pthread_equal(a, b) != 0; |
167 } | 172 } |
168 | 173 |
169 | 174 |
170 void OSThread::GetThreadCpuUsage(ThreadId thread_id, int64_t* cpu_usage) { | 175 void OSThread::GetThreadCpuUsage(ThreadId thread_id, int64_t* cpu_usage) { |
171 ASSERT(thread_id == GetCurrentThreadId()); | 176 ASSERT(thread_id == GetCurrentThreadId()); |
172 ASSERT(cpu_usage != NULL); | 177 ASSERT(cpu_usage != NULL); |
173 // TODO(johnmccutchan): Enable this after fixing issue with macos directory | 178 // TODO(johnmccutchan): Enable this after fixing issue with macos directory |
174 // watcher. | 179 // watcher. |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 | 360 |
356 void Monitor::NotifyAll() { | 361 void Monitor::NotifyAll() { |
357 // TODO(iposva): Do we need to track lock owners? | 362 // TODO(iposva): Do we need to track lock owners? |
358 int result = pthread_cond_broadcast(data_.cond()); | 363 int result = pthread_cond_broadcast(data_.cond()); |
359 VALIDATE_PTHREAD_RESULT(result); | 364 VALIDATE_PTHREAD_RESULT(result); |
360 } | 365 } |
361 | 366 |
362 } // namespace dart | 367 } // namespace dart |
363 | 368 |
364 #endif // defined(TARGET_OS_MACOS) | 369 #endif // defined(TARGET_OS_MACOS) |
OLD | NEW |