| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 result = pthread_create(&tid, &attr, ThreadStart, data); | 107 result = pthread_create(&tid, &attr, ThreadStart, data); |
| 108 RETURN_ON_PTHREAD_FAILURE(result); | 108 RETURN_ON_PTHREAD_FAILURE(result); |
| 109 | 109 |
| 110 result = pthread_attr_destroy(&attr); | 110 result = pthread_attr_destroy(&attr); |
| 111 RETURN_ON_PTHREAD_FAILURE(result); | 111 RETURN_ON_PTHREAD_FAILURE(result); |
| 112 | 112 |
| 113 return 0; | 113 return 0; |
| 114 } | 114 } |
| 115 | 115 |
| 116 | 116 |
| 117 ThreadLocalKey Thread::kUnsetThreadLocalKey = static_cast<pthread_key_t>(-1); | 117 const ThreadLocalKey Thread::kUnsetThreadLocalKey = |
| 118 ThreadId Thread::kInvalidThreadId = static_cast<ThreadId>(0); | 118 static_cast<pthread_key_t>(-1); |
| 119 const ThreadId Thread::kInvalidThreadId = static_cast<ThreadId>(0); |
| 119 | 120 |
| 120 ThreadLocalKey Thread::CreateThreadLocal() { | 121 ThreadLocalKey Thread::CreateThreadLocal() { |
| 121 pthread_key_t key = kUnsetThreadLocalKey; | 122 pthread_key_t key = kUnsetThreadLocalKey; |
| 122 int result = pthread_key_create(&key, NULL); | 123 int result = pthread_key_create(&key, NULL); |
| 123 VALIDATE_PTHREAD_RESULT(result); | 124 VALIDATE_PTHREAD_RESULT(result); |
| 124 ASSERT(key != kUnsetThreadLocalKey); | 125 ASSERT(key != kUnsetThreadLocalKey); |
| 125 return key; | 126 return key; |
| 126 } | 127 } |
| 127 | 128 |
| 128 | 129 |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 void Monitor::NotifyAll() { | 326 void Monitor::NotifyAll() { |
| 326 // TODO(iposva): Do we need to track lock owners? | 327 // TODO(iposva): Do we need to track lock owners? |
| 327 int result = pthread_cond_broadcast(data_.cond()); | 328 int result = pthread_cond_broadcast(data_.cond()); |
| 328 VALIDATE_PTHREAD_RESULT(result); | 329 VALIDATE_PTHREAD_RESULT(result); |
| 329 } | 330 } |
| 330 | 331 |
| 331 } // namespace bin | 332 } // namespace bin |
| 332 } // namespace dart | 333 } // namespace dart |
| 333 | 334 |
| 334 #endif // defined(TARGET_OS_ANDROID) | 335 #endif // defined(TARGET_OS_ANDROID) |
| OLD | NEW |