| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 result = pthread_create(&tid, &attr, ThreadStart, data); | 100 result = pthread_create(&tid, &attr, ThreadStart, data); |
| 101 RETURN_ON_PTHREAD_FAILURE(result); | 101 RETURN_ON_PTHREAD_FAILURE(result); |
| 102 | 102 |
| 103 result = pthread_attr_destroy(&attr); | 103 result = pthread_attr_destroy(&attr); |
| 104 RETURN_ON_PTHREAD_FAILURE(result); | 104 RETURN_ON_PTHREAD_FAILURE(result); |
| 105 | 105 |
| 106 return 0; | 106 return 0; |
| 107 } | 107 } |
| 108 | 108 |
| 109 | 109 |
| 110 ThreadLocalKey Thread::kUnsetThreadLocalKey = static_cast<pthread_key_t>(-1); | 110 const ThreadLocalKey Thread::kUnsetThreadLocalKey = |
| 111 ThreadId Thread::kInvalidThreadId = reinterpret_cast<ThreadId>(NULL); | 111 static_cast<pthread_key_t>(-1); |
| 112 const ThreadId Thread::kInvalidThreadId = reinterpret_cast<ThreadId>(NULL); |
| 112 | 113 |
| 113 ThreadLocalKey Thread::CreateThreadLocal() { | 114 ThreadLocalKey Thread::CreateThreadLocal() { |
| 114 pthread_key_t key = kUnsetThreadLocalKey; | 115 pthread_key_t key = kUnsetThreadLocalKey; |
| 115 int result = pthread_key_create(&key, NULL); | 116 int result = pthread_key_create(&key, NULL); |
| 116 VALIDATE_PTHREAD_RESULT(result); | 117 VALIDATE_PTHREAD_RESULT(result); |
| 117 ASSERT(key != kUnsetThreadLocalKey); | 118 ASSERT(key != kUnsetThreadLocalKey); |
| 118 return key; | 119 return key; |
| 119 } | 120 } |
| 120 | 121 |
| 121 | 122 |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 void Monitor::NotifyAll() { | 335 void Monitor::NotifyAll() { |
| 335 // TODO(iposva): Do we need to track lock owners? | 336 // TODO(iposva): Do we need to track lock owners? |
| 336 int result = pthread_cond_broadcast(data_.cond()); | 337 int result = pthread_cond_broadcast(data_.cond()); |
| 337 VALIDATE_PTHREAD_RESULT(result); | 338 VALIDATE_PTHREAD_RESULT(result); |
| 338 } | 339 } |
| 339 | 340 |
| 340 } // namespace bin | 341 } // namespace bin |
| 341 } // namespace dart | 342 } // namespace dart |
| 342 | 343 |
| 343 #endif // defined(TARGET_OS_MACOS) | 344 #endif // defined(TARGET_OS_MACOS) |
| OLD | NEW |