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

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

Issue 1978153002: Uses an open thread handle as the ThreadJoinId on Windows. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fix test Created 4 years, 7 months 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_android.cc ('k') | runtime/vm/os_thread_macos.cc » ('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 6
7 #if defined(TARGET_OS_LINUX) 7 #if defined(TARGET_OS_LINUX)
8 8
9 #include "vm/os_thread.h" 9 #include "vm/os_thread.h"
10 10
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 ThreadId OSThread::GetCurrentThreadId() { 187 ThreadId OSThread::GetCurrentThreadId() {
188 return pthread_self(); 188 return pthread_self();
189 } 189 }
190 190
191 191
192 ThreadId OSThread::GetCurrentThreadTraceId() { 192 ThreadId OSThread::GetCurrentThreadTraceId() {
193 return syscall(__NR_gettid); 193 return syscall(__NR_gettid);
194 } 194 }
195 195
196 196
197 ThreadJoinId OSThread::GetCurrentThreadJoinId() { 197 ThreadJoinId OSThread::GetCurrentThreadJoinId(OSThread* thread) {
198 return pthread_self(); 198 ASSERT(thread != NULL);
199 // Make sure we're filling in the join id for the current thread.
200 ASSERT(thread->id() == GetCurrentThreadId());
201 // Make sure the join_id_ hasn't been set, yet.
202 DEBUG_ASSERT(thread->join_id_ == kInvalidThreadJoinId);
203 pthread_t id = pthread_self();
204 #if defined(DEBUG)
205 thread->join_id_ = id;
206 #endif
207 return id;
199 } 208 }
200 209
201 210
202 void OSThread::Join(ThreadJoinId id) { 211 void OSThread::Join(ThreadJoinId id) {
203 int result = pthread_join(id, NULL); 212 int result = pthread_join(id, NULL);
204 ASSERT(result == 0); 213 ASSERT(result == 0);
205 } 214 }
206 215
207 216
208 intptr_t OSThread::ThreadIdToIntPtr(ThreadId id) { 217 intptr_t OSThread::ThreadIdToIntPtr(ThreadId id) {
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 void Monitor::NotifyAll() { 446 void Monitor::NotifyAll() {
438 // When running with assertions enabled we track the owner. 447 // When running with assertions enabled we track the owner.
439 ASSERT(IsOwnedByCurrentThread()); 448 ASSERT(IsOwnedByCurrentThread());
440 int result = pthread_cond_broadcast(data_.cond()); 449 int result = pthread_cond_broadcast(data_.cond());
441 VALIDATE_PTHREAD_RESULT(result); 450 VALIDATE_PTHREAD_RESULT(result);
442 } 451 }
443 452
444 } // namespace dart 453 } // namespace dart
445 454
446 #endif // defined(TARGET_OS_LINUX) 455 #endif // defined(TARGET_OS_LINUX)
OLDNEW
« no previous file with comments | « runtime/vm/os_thread_android.cc ('k') | runtime/vm/os_thread_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698