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" | 5 #include "platform/globals.h" |
6 #if defined(TARGET_OS_ANDROID) | 6 #if defined(TARGET_OS_ANDROID) |
7 | 7 |
8 #include "platform/thread.h" | 8 #include "platform/thread.h" |
9 | 9 |
10 #include <errno.h> // NOLINT | 10 #include <errno.h> // NOLINT |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 VALIDATE_PTHREAD_RESULT(result); | 137 VALIDATE_PTHREAD_RESULT(result); |
138 } | 138 } |
139 | 139 |
140 | 140 |
141 intptr_t Thread::GetMaxStackSize() { | 141 intptr_t Thread::GetMaxStackSize() { |
142 const int kStackSize = (128 * kWordSize * KB); | 142 const int kStackSize = (128 * kWordSize * KB); |
143 return kStackSize; | 143 return kStackSize; |
144 } | 144 } |
145 | 145 |
146 | 146 |
| 147 ThreadId Thread::GetCurrentThreadId() { |
| 148 return pthread_self(); |
| 149 } |
| 150 |
| 151 |
147 Mutex::Mutex() { | 152 Mutex::Mutex() { |
148 pthread_mutexattr_t attr; | 153 pthread_mutexattr_t attr; |
149 int result = pthread_mutexattr_init(&attr); | 154 int result = pthread_mutexattr_init(&attr); |
150 VALIDATE_PTHREAD_RESULT(result); | 155 VALIDATE_PTHREAD_RESULT(result); |
151 | 156 |
152 #if defined(DEBUG) | 157 #if defined(DEBUG) |
153 result = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK); | 158 result = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK); |
154 VALIDATE_PTHREAD_RESULT(result); | 159 VALIDATE_PTHREAD_RESULT(result); |
155 #endif // defined(DEBUG) | 160 #endif // defined(DEBUG) |
156 | 161 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 | 286 |
282 void Monitor::NotifyAll() { | 287 void Monitor::NotifyAll() { |
283 // TODO(iposva): Do we need to track lock owners? | 288 // TODO(iposva): Do we need to track lock owners? |
284 int result = pthread_cond_broadcast(data_.cond()); | 289 int result = pthread_cond_broadcast(data_.cond()); |
285 VALIDATE_PTHREAD_RESULT(result); | 290 VALIDATE_PTHREAD_RESULT(result); |
286 } | 291 } |
287 | 292 |
288 } // namespace dart | 293 } // namespace dart |
289 | 294 |
290 #endif // defined(TARGET_OS_ANDROID) | 295 #endif // defined(TARGET_OS_ANDROID) |
OLD | NEW |