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_MACOS) | 6 #if defined(TARGET_OS_MACOS) |
7 | 7 |
8 #include "bin/thread.h" | 8 #include "bin/thread.h" |
9 | 9 |
10 #include <sys/errno.h> // NOLINT | 10 #include <sys/errno.h> // NOLINT |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 if (r == KERN_SUCCESS) { | 176 if (r == KERN_SUCCESS) { |
177 *cpu_usage = (info->user_time.seconds * kMicrosecondsPerSecond) + | 177 *cpu_usage = (info->user_time.seconds * kMicrosecondsPerSecond) + |
178 info->user_time.microseconds; | 178 info->user_time.microseconds; |
179 return; | 179 return; |
180 } | 180 } |
181 } | 181 } |
182 *cpu_usage = 0; | 182 *cpu_usage = 0; |
183 } | 183 } |
184 | 184 |
185 | 185 |
| 186 void Thread::InitOnce() { |
| 187 // Nothing to be done. |
| 188 } |
| 189 |
| 190 |
186 Mutex::Mutex() { | 191 Mutex::Mutex() { |
187 pthread_mutexattr_t attr; | 192 pthread_mutexattr_t attr; |
188 int result = pthread_mutexattr_init(&attr); | 193 int result = pthread_mutexattr_init(&attr); |
189 VALIDATE_PTHREAD_RESULT(result); | 194 VALIDATE_PTHREAD_RESULT(result); |
190 | 195 |
191 #if defined(DEBUG) | 196 #if defined(DEBUG) |
192 result = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK); | 197 result = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK); |
193 VALIDATE_PTHREAD_RESULT(result); | 198 VALIDATE_PTHREAD_RESULT(result); |
194 #endif // defined(DEBUG) | 199 #endif // defined(DEBUG) |
195 | 200 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 void Monitor::NotifyAll() { | 333 void Monitor::NotifyAll() { |
329 // TODO(iposva): Do we need to track lock owners? | 334 // TODO(iposva): Do we need to track lock owners? |
330 int result = pthread_cond_broadcast(data_.cond()); | 335 int result = pthread_cond_broadcast(data_.cond()); |
331 VALIDATE_PTHREAD_RESULT(result); | 336 VALIDATE_PTHREAD_RESULT(result); |
332 } | 337 } |
333 | 338 |
334 } // namespace bin | 339 } // namespace bin |
335 } // namespace dart | 340 } // namespace dart |
336 | 341 |
337 #endif // defined(TARGET_OS_MACOS) | 342 #endif // defined(TARGET_OS_MACOS) |
OLD | NEW |