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