Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: runtime/vm/os_thread_linux.cc

Issue 1482243006: VM: Small clean up and const-ness fix for Thread/OSThread constants. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/os_thread_linux.h ('k') | runtime/vm/os_thread_macos.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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)
OLDNEW
« no previous file with comments | « runtime/vm/os_thread_linux.h ('k') | runtime/vm/os_thread_macos.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698