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

Side by Side Diff: runtime/vm/os_thread_macos.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_macos.h ('k') | runtime/vm/os_thread_win.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_MACOS) 6 #if defined(TARGET_OS_MACOS)
7 7
8 #include "vm/os_thread.h" 8 #include "vm/os_thread.h"
9 9
10 #include <sys/errno.h> // NOLINT 10 #include <sys/errno.h> // NOLINT
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 result = pthread_create(&tid, &attr, ThreadStart, data); 115 result = pthread_create(&tid, &attr, ThreadStart, data);
116 RETURN_ON_PTHREAD_FAILURE(result); 116 RETURN_ON_PTHREAD_FAILURE(result);
117 117
118 result = pthread_attr_destroy(&attr); 118 result = pthread_attr_destroy(&attr);
119 RETURN_ON_PTHREAD_FAILURE(result); 119 RETURN_ON_PTHREAD_FAILURE(result);
120 120
121 return 0; 121 return 0;
122 } 122 }
123 123
124 124
125 ThreadLocalKey OSThread::kUnsetThreadLocalKey = 125 const ThreadId OSThread::kInvalidThreadId = reinterpret_cast<ThreadId>(NULL);
126 static_cast<pthread_key_t>(-1); 126 const ThreadJoinId OSThread::kInvalidThreadJoinId =
127 ThreadId OSThread::kInvalidThreadId = reinterpret_cast<ThreadId>(NULL);
128 ThreadJoinId OSThread::kInvalidThreadJoinId =
129 reinterpret_cast<ThreadJoinId>(NULL); 127 reinterpret_cast<ThreadJoinId>(NULL);
130 128
129
131 ThreadLocalKey OSThread::CreateThreadLocal(ThreadDestructor destructor) { 130 ThreadLocalKey OSThread::CreateThreadLocal(ThreadDestructor destructor) {
132 pthread_key_t key = kUnsetThreadLocalKey; 131 pthread_key_t key = kUnsetThreadLocalKey;
133 int result = pthread_key_create(&key, destructor); 132 int result = pthread_key_create(&key, destructor);
134 VALIDATE_PTHREAD_RESULT(result); 133 VALIDATE_PTHREAD_RESULT(result);
135 ASSERT(key != kUnsetThreadLocalKey); 134 ASSERT(key != kUnsetThreadLocalKey);
136 return key; 135 return key;
137 } 136 }
138 137
139 138
140 void OSThread::DeleteThreadLocal(ThreadLocalKey key) { 139 void OSThread::DeleteThreadLocal(ThreadLocalKey key) {
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 void Monitor::NotifyAll() { 416 void Monitor::NotifyAll() {
418 // When running with assertions enabled we track the owner. 417 // When running with assertions enabled we track the owner.
419 ASSERT(IsOwnedByCurrentThread()); 418 ASSERT(IsOwnedByCurrentThread());
420 int result = pthread_cond_broadcast(data_.cond()); 419 int result = pthread_cond_broadcast(data_.cond());
421 VALIDATE_PTHREAD_RESULT(result); 420 VALIDATE_PTHREAD_RESULT(result);
422 } 421 }
423 422
424 } // namespace dart 423 } // namespace dart
425 424
426 #endif // defined(TARGET_OS_MACOS) 425 #endif // defined(TARGET_OS_MACOS)
OLDNEW
« no previous file with comments | « runtime/vm/os_thread_macos.h ('k') | runtime/vm/os_thread_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698