| 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" // NOLINT | 5 #include "platform/globals.h" // NOLINT |
| 6 #if defined(TARGET_OS_ANDROID) | 6 #if defined(TARGET_OS_ANDROID) |
| 7 | 7 |
| 8 #include "vm/os_thread.h" | 8 #include "vm/os_thread.h" |
| 9 | 9 |
| 10 #include <errno.h> // NOLINT | 10 #include <errno.h> // NOLINT |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 RETURN_ON_PTHREAD_FAILURE(result); | 109 RETURN_ON_PTHREAD_FAILURE(result); |
| 110 | 110 |
| 111 return 0; | 111 return 0; |
| 112 } | 112 } |
| 113 | 113 |
| 114 | 114 |
| 115 ThreadLocalKey OSThread::kUnsetThreadLocalKey = | 115 ThreadLocalKey OSThread::kUnsetThreadLocalKey = |
| 116 static_cast<pthread_key_t>(-1); | 116 static_cast<pthread_key_t>(-1); |
| 117 ThreadId OSThread::kInvalidThreadId = static_cast<ThreadId>(0); | 117 ThreadId OSThread::kInvalidThreadId = static_cast<ThreadId>(0); |
| 118 | 118 |
| 119 ThreadLocalKey OSThread::CreateThreadLocal() { | 119 ThreadLocalKey OSThread::CreateThreadLocal(ThreadDestructor destructor) { |
| 120 pthread_key_t key = kUnsetThreadLocalKey; | 120 pthread_key_t key = kUnsetThreadLocalKey; |
| 121 int result = pthread_key_create(&key, NULL); | 121 int result = pthread_key_create(&key, destructor); |
| 122 VALIDATE_PTHREAD_RESULT(result); | 122 VALIDATE_PTHREAD_RESULT(result); |
| 123 ASSERT(key != kUnsetThreadLocalKey); | 123 ASSERT(key != kUnsetThreadLocalKey); |
| 124 return key; | 124 return key; |
| 125 } | 125 } |
| 126 | 126 |
| 127 | 127 |
| 128 void OSThread::DeleteThreadLocal(ThreadLocalKey key) { | 128 void OSThread::DeleteThreadLocal(ThreadLocalKey key) { |
| 129 ASSERT(key != kUnsetThreadLocalKey); | 129 ASSERT(key != kUnsetThreadLocalKey); |
| 130 int result = pthread_key_delete(key); | 130 int result = pthread_key_delete(key); |
| 131 VALIDATE_PTHREAD_RESULT(result); | 131 VALIDATE_PTHREAD_RESULT(result); |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 | 338 |
| 339 void Monitor::NotifyAll() { | 339 void Monitor::NotifyAll() { |
| 340 // TODO(iposva): Do we need to track lock owners? | 340 // TODO(iposva): Do we need to track lock owners? |
| 341 int result = pthread_cond_broadcast(data_.cond()); | 341 int result = pthread_cond_broadcast(data_.cond()); |
| 342 VALIDATE_PTHREAD_RESULT(result); | 342 VALIDATE_PTHREAD_RESULT(result); |
| 343 } | 343 } |
| 344 | 344 |
| 345 } // namespace dart | 345 } // namespace dart |
| 346 | 346 |
| 347 #endif // defined(TARGET_OS_ANDROID) | 347 #endif // defined(TARGET_OS_ANDROID) |
| OLD | NEW |