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

Unified 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: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | runtime/vm/os_thread.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/os_thread.h
diff --git a/runtime/vm/os_thread.h b/runtime/vm/os_thread.h
index 1bd2193b20cbd3ca951e522836c52e6836f22b1a..415cff89b5dcceb9719b616355f60e3461c89b9a 100644
--- a/runtime/vm/os_thread.h
+++ b/runtime/vm/os_thread.h
@@ -61,13 +61,8 @@ class OSThread : public BaseThread {
return id_;
}
- ThreadJoinId join_id() const {
- ASSERT(join_id_ != OSThread::kInvalidThreadJoinId);
- return join_id_;
- }
-
ThreadId trace_id() const {
- ASSERT(trace_id_ != OSThread::kInvalidThreadJoinId);
+ ASSERT(trace_id_ != OSThread::kInvalidThreadId);
return trace_id_;
}
@@ -174,10 +169,14 @@ class OSThread : public BaseThread {
static ThreadId ThreadIdFromIntPtr(intptr_t id);
static bool Compare(ThreadId a, ThreadId b);
+ // This function can be called only once per OSThread, and should only be
+ // called when the retunred id will eventually be passed to OSThread::Join().
+ static ThreadJoinId GetCurrentThreadJoinId(OSThread* thread);
+
// Called at VM startup and shutdown.
static void InitOnce();
- static bool IsThreadInList(ThreadJoinId join_id);
+ static bool IsThreadInList(ThreadId id);
static void DisableOSThreadCreation();
static void EnableOSThreadCreation();
@@ -205,7 +204,6 @@ class OSThread : public BaseThread {
static void Cleanup();
static ThreadId GetCurrentThreadTraceId();
- static ThreadJoinId GetCurrentThreadJoinId();
static OSThread* GetOSThreadFromThread(Thread* thread);
static void AddThreadToListLocked(OSThread* thread);
static void RemoveThreadFromList(OSThread* thread);
@@ -214,7 +212,11 @@ class OSThread : public BaseThread {
static ThreadLocalKey thread_key_;
const ThreadId id_;
- const ThreadJoinId join_id_;
+#if defined(DEBUG)
+ // In DEBUG mode we use this field to ensure that GetCurrentThreadJoinId is
+ // only called once per OSThread.
+ ThreadJoinId join_id_;
+#endif
const ThreadId trace_id_; // Used to interface with tracing tools.
char* name_; // A name for this thread.
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | runtime/vm/os_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698