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