| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 result = pthread_create(&tid, &attr, ThreadStart, data); | 122 result = pthread_create(&tid, &attr, ThreadStart, data); |
| 123 RETURN_ON_PTHREAD_FAILURE(result); | 123 RETURN_ON_PTHREAD_FAILURE(result); |
| 124 | 124 |
| 125 result = pthread_attr_destroy(&attr); | 125 result = pthread_attr_destroy(&attr); |
| 126 RETURN_ON_PTHREAD_FAILURE(result); | 126 RETURN_ON_PTHREAD_FAILURE(result); |
| 127 | 127 |
| 128 return 0; | 128 return 0; |
| 129 } | 129 } |
| 130 | 130 |
| 131 | 131 |
| 132 ThreadLocalKey OSThread::kUnsetThreadLocalKey = | 132 const ThreadId OSThread::kInvalidThreadId = static_cast<ThreadId>(0); |
| 133 static_cast<pthread_key_t>(-1); | 133 const ThreadJoinId OSThread::kInvalidThreadJoinId = |
| 134 ThreadId OSThread::kInvalidThreadId = static_cast<ThreadId>(0); | 134 static_cast<ThreadJoinId>(0); |
| 135 ThreadJoinId OSThread::kInvalidThreadJoinId = static_cast<ThreadJoinId>(0); | 135 |
| 136 | 136 |
| 137 ThreadLocalKey OSThread::CreateThreadLocal(ThreadDestructor destructor) { | 137 ThreadLocalKey OSThread::CreateThreadLocal(ThreadDestructor destructor) { |
| 138 pthread_key_t key = kUnsetThreadLocalKey; | 138 pthread_key_t key = kUnsetThreadLocalKey; |
| 139 int result = pthread_key_create(&key, destructor); | 139 int result = pthread_key_create(&key, destructor); |
| 140 VALIDATE_PTHREAD_RESULT(result); | 140 VALIDATE_PTHREAD_RESULT(result); |
| 141 ASSERT(key != kUnsetThreadLocalKey); | 141 ASSERT(key != kUnsetThreadLocalKey); |
| 142 return key; | 142 return key; |
| 143 } | 143 } |
| 144 | 144 |
| 145 | 145 |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 void Monitor::NotifyAll() { | 407 void Monitor::NotifyAll() { |
| 408 // When running with assertions enabled we track the owner. | 408 // When running with assertions enabled we track the owner. |
| 409 ASSERT(IsOwnedByCurrentThread()); | 409 ASSERT(IsOwnedByCurrentThread()); |
| 410 int result = pthread_cond_broadcast(data_.cond()); | 410 int result = pthread_cond_broadcast(data_.cond()); |
| 411 VALIDATE_PTHREAD_RESULT(result); | 411 VALIDATE_PTHREAD_RESULT(result); |
| 412 } | 412 } |
| 413 | 413 |
| 414 } // namespace dart | 414 } // namespace dart |
| 415 | 415 |
| 416 #endif // defined(TARGET_OS_ANDROID) | 416 #endif // defined(TARGET_OS_ANDROID) |
| OLD | NEW |