| 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 | 6 |
| 7 | 7 |
| 8 #if defined(TARGET_OS_ANDROID) | 8 #if defined(TARGET_OS_ANDROID) |
| 9 | 9 |
| 10 #include "vm/os_thread.h" | 10 #include "vm/os_thread.h" |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 ThreadId OSThread::GetCurrentThreadId() { | 186 ThreadId OSThread::GetCurrentThreadId() { |
| 187 return gettid(); | 187 return gettid(); |
| 188 } | 188 } |
| 189 | 189 |
| 190 | 190 |
| 191 ThreadId OSThread::GetCurrentThreadTraceId() { | 191 ThreadId OSThread::GetCurrentThreadTraceId() { |
| 192 return GetCurrentThreadId(); | 192 return GetCurrentThreadId(); |
| 193 } | 193 } |
| 194 | 194 |
| 195 | 195 |
| 196 ThreadJoinId OSThread::GetCurrentThreadJoinId() { | 196 ThreadJoinId OSThread::GetCurrentThreadJoinId(OSThread* thread) { |
| 197 return pthread_self(); | 197 ASSERT(thread != NULL); |
| 198 // Make sure we're filling in the join id for the current thread. |
| 199 ASSERT(thread->id() == GetCurrentThreadId()); |
| 200 // Make sure the join_id_ hasn't been set, yet. |
| 201 DEBUG_ASSERT(thread->join_id_ == kInvalidThreadJoinId); |
| 202 pthread_t id = pthread_self(); |
| 203 #if defined(DEBUG) |
| 204 thread->join_id_ = id; |
| 205 #endif |
| 206 return id; |
| 198 } | 207 } |
| 199 | 208 |
| 200 | 209 |
| 201 void OSThread::Join(ThreadJoinId id) { | 210 void OSThread::Join(ThreadJoinId id) { |
| 202 int result = pthread_join(id, NULL); | 211 int result = pthread_join(id, NULL); |
| 203 ASSERT(result == 0); | 212 ASSERT(result == 0); |
| 204 } | 213 } |
| 205 | 214 |
| 206 | 215 |
| 207 intptr_t OSThread::ThreadIdToIntPtr(ThreadId id) { | 216 intptr_t OSThread::ThreadIdToIntPtr(ThreadId id) { |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 void Monitor::NotifyAll() { | 441 void Monitor::NotifyAll() { |
| 433 // When running with assertions enabled we track the owner. | 442 // When running with assertions enabled we track the owner. |
| 434 ASSERT(IsOwnedByCurrentThread()); | 443 ASSERT(IsOwnedByCurrentThread()); |
| 435 int result = pthread_cond_broadcast(data_.cond()); | 444 int result = pthread_cond_broadcast(data_.cond()); |
| 436 VALIDATE_PTHREAD_RESULT(result); | 445 VALIDATE_PTHREAD_RESULT(result); |
| 437 } | 446 } |
| 438 | 447 |
| 439 } // namespace dart | 448 } // namespace dart |
| 440 | 449 |
| 441 #endif // defined(TARGET_OS_ANDROID) | 450 #endif // defined(TARGET_OS_ANDROID) |
| OLD | NEW |