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 "bin/thread.h" | 8 #include "bin/thread.h" |
9 | 9 |
10 #include <errno.h> // NOLINT | 10 #include <errno.h> // NOLINT |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 ASSERT(thread_id == GetCurrentThreadId()); | 170 ASSERT(thread_id == GetCurrentThreadId()); |
171 ASSERT(cpu_usage != NULL); | 171 ASSERT(cpu_usage != NULL); |
172 struct timespec ts; | 172 struct timespec ts; |
173 int r = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts); | 173 int r = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts); |
174 ASSERT(r == 0); | 174 ASSERT(r == 0); |
175 *cpu_usage = (ts.tv_sec * kNanosecondsPerSecond + ts.tv_nsec) / | 175 *cpu_usage = (ts.tv_sec * kNanosecondsPerSecond + ts.tv_nsec) / |
176 kNanosecondsPerMicrosecond; | 176 kNanosecondsPerMicrosecond; |
177 } | 177 } |
178 | 178 |
179 | 179 |
| 180 void Thread::InitOnce() { |
| 181 // Nothing to be done. |
| 182 } |
| 183 |
| 184 |
180 Mutex::Mutex() { | 185 Mutex::Mutex() { |
181 pthread_mutexattr_t attr; | 186 pthread_mutexattr_t attr; |
182 int result = pthread_mutexattr_init(&attr); | 187 int result = pthread_mutexattr_init(&attr); |
183 VALIDATE_PTHREAD_RESULT(result); | 188 VALIDATE_PTHREAD_RESULT(result); |
184 | 189 |
185 #if defined(DEBUG) | 190 #if defined(DEBUG) |
186 result = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK); | 191 result = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK); |
187 VALIDATE_PTHREAD_RESULT(result); | 192 VALIDATE_PTHREAD_RESULT(result); |
188 #endif // defined(DEBUG) | 193 #endif // defined(DEBUG) |
189 | 194 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 void Monitor::NotifyAll() { | 324 void Monitor::NotifyAll() { |
320 // TODO(iposva): Do we need to track lock owners? | 325 // TODO(iposva): Do we need to track lock owners? |
321 int result = pthread_cond_broadcast(data_.cond()); | 326 int result = pthread_cond_broadcast(data_.cond()); |
322 VALIDATE_PTHREAD_RESULT(result); | 327 VALIDATE_PTHREAD_RESULT(result); |
323 } | 328 } |
324 | 329 |
325 } // namespace bin | 330 } // namespace bin |
326 } // namespace dart | 331 } // namespace dart |
327 | 332 |
328 #endif // defined(TARGET_OS_ANDROID) | 333 #endif // defined(TARGET_OS_ANDROID) |
OLD | NEW |