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. |