Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/coreclr/nativeaot/Runtime/eventpipe/ep-rt-aot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ ep_rt_thread_handle_t ep_rt_aot_setup_thread (void)

ep_rt_thread_id_t ep_rt_aot_thread_get_id (ep_rt_thread_handle_t thread_handle)
{
return (ep_rt_thread_id_t)thread_handle->GetPalThreadIdForLogging();
return (ep_rt_thread_id_t)thread_handle->GetOSThreadId();
}

#ifdef EP_CHECKED_BUILD
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/nativeaot/Runtime/gcenv.ee.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ void GCToEEInterface::LogErrorToHost(const char *message)

uint64_t GCToEEInterface::GetThreadOSThreadId(Thread* thread)
{
return (uint64_t)thread->GetPalThreadIdForLogging();
return (uint64_t)thread->GetOSThreadId();
}

bool GCToEEInterface::GetStringConfigValue(const char* privateKey, const char* publicKey, const char** value)
Expand Down
7 changes: 7 additions & 0 deletions src/coreclr/nativeaot/Runtime/thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,13 @@ uint64_t Thread::GetPalThreadIdForLogging()
return m_threadId;
}

// Returns the OS thread ID. This is the proper method to get the thread ID for general use
// (e.g., EventPipe, GC). GetPalThreadIdForLogging() should only be used for logging purposes.
uint64_t Thread::GetOSThreadId()
{
return m_threadId;
}

uint64_t Thread::s_DeadThreadsNonAllocBytes = 0;

/* static*/
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/nativeaot/Runtime/thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ class Thread : private RuntimeThreadLocals
gc_alloc_context * GetAllocContext();

uint64_t GetPalThreadIdForLogging();
uint64_t GetOSThreadId();

void GcScanRoots(ScanFunc* pfnEnumCallback, ScanContext * pvCallbackData);

Expand Down