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

Side by Side Diff: runtime/vm/os_thread.h

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: 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
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 #ifndef VM_OS_THREAD_H_ 5 #ifndef VM_OS_THREAD_H_
6 #define VM_OS_THREAD_H_ 6 #define VM_OS_THREAD_H_
7 7
8 #include "platform/globals.h" 8 #include "platform/globals.h"
9 #include "vm/allocation.h" 9 #include "vm/allocation.h"
10 #include "vm/globals.h" 10 #include "vm/globals.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 ASSERT(id_ != OSThread::kInvalidThreadId); 60 ASSERT(id_ != OSThread::kInvalidThreadId);
61 return id_; 61 return id_;
62 } 62 }
63 63
64 ThreadJoinId join_id() const { 64 ThreadJoinId join_id() const {
65 ASSERT(join_id_ != OSThread::kInvalidThreadJoinId); 65 ASSERT(join_id_ != OSThread::kInvalidThreadJoinId);
66 return join_id_; 66 return join_id_;
67 } 67 }
68 68
69 ThreadId trace_id() const { 69 ThreadId trace_id() const {
70 ASSERT(trace_id_ != OSThread::kInvalidThreadJoinId); 70 ASSERT(trace_id_ != OSThread::kInvalidThreadId);
71 return trace_id_; 71 return trace_id_;
72 } 72 }
73 73
74 const char* name() const { 74 const char* name() const {
75 return name_; 75 return name_;
76 } 76 }
77 77
78 void SetName(const char* name); 78 void SetName(const char* name);
79 79
80 void set_name(const char* name) { 80 void set_name(const char* name) {
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 // in the windows thread interrupter which is used for profiling. 198 // in the windows thread interrupter which is used for profiling.
199 // We could eliminate this requirement if the windows thread interrupter 199 // We could eliminate this requirement if the windows thread interrupter
200 // is implemented differently. 200 // is implemented differently.
201 Thread* thread() const { return thread_; } 201 Thread* thread() const { return thread_; }
202 void set_thread(Thread* value) { 202 void set_thread(Thread* value) {
203 thread_ = value; 203 thread_ = value;
204 } 204 }
205 205
206 static void Cleanup(); 206 static void Cleanup();
207 static ThreadId GetCurrentThreadTraceId(); 207 static ThreadId GetCurrentThreadTraceId();
208
209 // WARNING: The Windows implementation relies on this function begin called
210 // only once per-thread in the constructor for an OSThread.
Ivan Posva 2016/05/16 17:13:14 We should enforce this as we discussed instead of
208 static ThreadJoinId GetCurrentThreadJoinId(); 211 static ThreadJoinId GetCurrentThreadJoinId();
212
209 static OSThread* GetOSThreadFromThread(Thread* thread); 213 static OSThread* GetOSThreadFromThread(Thread* thread);
210 static void AddThreadToListLocked(OSThread* thread); 214 static void AddThreadToListLocked(OSThread* thread);
211 static void RemoveThreadFromList(OSThread* thread); 215 static void RemoveThreadFromList(OSThread* thread);
212 static OSThread* CreateAndSetUnknownThread(); 216 static OSThread* CreateAndSetUnknownThread();
213 217
214 static ThreadLocalKey thread_key_; 218 static ThreadLocalKey thread_key_;
215 219
216 const ThreadId id_; 220 const ThreadId id_;
217 const ThreadJoinId join_id_; 221 const ThreadJoinId join_id_;
218 const ThreadId trace_id_; // Used to interface with tracing tools. 222 const ThreadId trace_id_; // Used to interface with tracing tools.
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 friend class SafepointMonitorLocker; 348 friend class SafepointMonitorLocker;
345 friend void Dart_TestMonitor(); 349 friend void Dart_TestMonitor();
346 DISALLOW_COPY_AND_ASSIGN(Monitor); 350 DISALLOW_COPY_AND_ASSIGN(Monitor);
347 }; 351 };
348 352
349 353
350 } // namespace dart 354 } // namespace dart
351 355
352 356
353 #endif // VM_OS_THREAD_H_ 357 #endif // VM_OS_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698