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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 const int kStackSize = (128 * kWordSize * KB); | 156 const int kStackSize = (128 * kWordSize * KB); |
157 return kStackSize; | 157 return kStackSize; |
158 } | 158 } |
159 | 159 |
160 | 160 |
161 ThreadId OSThread::GetCurrentThreadId() { | 161 ThreadId OSThread::GetCurrentThreadId() { |
162 return pthread_self(); | 162 return pthread_self(); |
163 } | 163 } |
164 | 164 |
165 | 165 |
| 166 #ifndef PRODUCT |
166 ThreadId OSThread::GetCurrentThreadTraceId() { | 167 ThreadId OSThread::GetCurrentThreadTraceId() { |
167 return ThreadIdFromIntPtr(pthread_mach_thread_np(pthread_self())); | 168 return ThreadIdFromIntPtr(pthread_mach_thread_np(pthread_self())); |
168 } | 169 } |
| 170 #endif // PRODUCT |
169 | 171 |
170 | 172 |
171 ThreadJoinId OSThread::GetCurrentThreadJoinId(OSThread* thread) { | 173 ThreadJoinId OSThread::GetCurrentThreadJoinId(OSThread* thread) { |
172 ASSERT(thread != NULL); | 174 ASSERT(thread != NULL); |
173 // Make sure we're filling in the join id for the current thread. | 175 // Make sure we're filling in the join id for the current thread. |
174 ASSERT(thread->id() == GetCurrentThreadId()); | 176 ASSERT(thread->id() == GetCurrentThreadId()); |
175 // Make sure the join_id_ hasn't been set, yet. | 177 // Make sure the join_id_ hasn't been set, yet. |
176 DEBUG_ASSERT(thread->join_id_ == kInvalidThreadJoinId); | 178 DEBUG_ASSERT(thread->join_id_ == kInvalidThreadJoinId); |
177 pthread_t id = pthread_self(); | 179 pthread_t id = pthread_self(); |
178 #if defined(DEBUG) | 180 #if defined(DEBUG) |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 void Monitor::NotifyAll() { | 421 void Monitor::NotifyAll() { |
420 // When running with assertions enabled we track the owner. | 422 // When running with assertions enabled we track the owner. |
421 ASSERT(IsOwnedByCurrentThread()); | 423 ASSERT(IsOwnedByCurrentThread()); |
422 int result = pthread_cond_broadcast(data_.cond()); | 424 int result = pthread_cond_broadcast(data_.cond()); |
423 VALIDATE_PTHREAD_RESULT(result); | 425 VALIDATE_PTHREAD_RESULT(result); |
424 } | 426 } |
425 | 427 |
426 } // namespace dart | 428 } // namespace dart |
427 | 429 |
428 #endif // defined(TARGET_OS_MACOS) | 430 #endif // defined(TARGET_OS_MACOS) |
OLD | NEW |