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