Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 5 additions & 1 deletion src/coreclr/debug/ee/rcthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1311,6 +1311,11 @@ void DebuggerRCThread::TemporaryHelperThreadMainLoop()

DebuggerRCThread* t = (DebuggerRCThread*)g_pRCThread;

if (FAILED(SetThreadName(t->m_thread, W(".NET Debugger"))))
{
LOG((LF_CORDB, LL_INFO10000, "DebuggerRCThread name set failed\n"));
}

t->ThreadProc(); // this thread is local, go and become the helper

return 0;
Expand Down Expand Up @@ -1366,7 +1371,6 @@ HRESULT DebuggerRCThread::Start(void)
{
LOG((LF_CORDB, LL_EVERYTHING, "DebuggerRCThread failed, err=%d\n", GetLastError()));
hr = HRESULT_FROM_GetLastError();

}
else
{
Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/debug/shared/dbgtransportsession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1227,6 +1227,8 @@ void DbgTransportSession::InitSessionState()
// instance method version defined below for convenience in the implementation.
DWORD WINAPI DbgTransportSession::TransportWorkerStatic(LPVOID pvContext)
{
SetThreadName(GetCurrentThread(), W(".NET DebugPipe"));

((DbgTransportSession*)pvContext)->TransportWorker();

// Nobody looks at this result, the choice of 0 is arbitrary.
Expand Down
4 changes: 4 additions & 0 deletions src/coreclr/pal/src/synchmgr/synchmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1707,6 +1707,10 @@ namespace CorUnix
reinterpret_cast<CPalSynchronizationManager*>(pArg);
CPalThread * pthrWorker = InternalGetCurrentThread();

InternalSetThreadDescription(pthrWorker,
PAL_GetCurrentThread(),
W(".NET SynchManager"));

while (!fWorkerIsDone)
{
LONG lProcessCount;
Expand Down
8 changes: 8 additions & 0 deletions src/coreclr/vm/eventing/eventpipe/ep-rt-coreclr.h
Original file line number Diff line number Diff line change
Expand Up @@ -2047,6 +2047,14 @@ ep_rt_thread_create (
return result;
}

static
inline
void
ep_rt_set_server_name()
{
::SetThreadName(GetCurrentThread(), W(".NET EventPipe"));
}

static
inline
void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ private static void CreateGateThread(PortableThreadPool threadPoolInstance)
{
IsThreadPoolThread = true,
IsBackground = true,
Name = ".NET ThreadPool Gate"
Name = ".NET TP Gate"
};
gateThread.UnsafeStart();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public WaitThread()
{
IsThreadPoolThread = true,
IsBackground = true,
Name = ".NET ThreadPool Wait"
Name = ".NET TP Wait"
};
waitThread.UnsafeStart();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1355,7 +1355,7 @@ internal static void PerformWaitOrTimerCallback(_ThreadPoolWaitOrTimerCallback h

public static partial class ThreadPool
{
internal const string WorkerThreadName = ".NET ThreadPool Worker";
internal const string WorkerThreadName = ".NET TP Worker";

internal static readonly ThreadPoolWorkQueue s_workQueue = new ThreadPoolWorkQueue();

Expand Down
8 changes: 8 additions & 0 deletions src/mono/mono/eventpipe/ep-rt-mono.h
Original file line number Diff line number Diff line change
Expand Up @@ -1359,6 +1359,14 @@ ep_rt_thread_create (
return false;
}

static
inline
void
ep_rt_set_server_name()
{
mono_native_thread_set_name(mono_native_thread_id_get(), ".NET EventPipe");
}

static
inline
void
Expand Down
6 changes: 4 additions & 2 deletions src/native/eventpipe/ds-server.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ EP_RT_DEFINE_THREAD_FUNC (server_thread)
{
EP_ASSERT (server_volatile_load_shutting_down_state () || ds_ipc_stream_factory_has_active_ports ());

ep_rt_set_server_name();

if (!ds_ipc_stream_factory_has_active_ports ()) {
#ifndef DS_IPC_DISABLE_LISTEN_PORTS
DS_LOG_ERROR_0 ("Diagnostics IPC listener was undefined");
Expand Down Expand Up @@ -256,7 +258,7 @@ ds_server_shutdown (void)
void
ds_server_pause_for_diagnostics_monitor (void)
{
_is_paused_for_startup = true;
_is_paused_for_startup = true;

if (ds_ipc_stream_factory_any_suspended_ports ()) {
EP_ASSERT (ep_rt_wait_event_is_valid (&_server_resume_runtime_startup_event));
Expand All @@ -278,7 +280,7 @@ ds_server_resume_runtime_startup (void)
ds_ipc_stream_factory_resume_current_port ();
if (!ds_ipc_stream_factory_any_suspended_ports () && ep_rt_wait_event_is_valid (&_server_resume_runtime_startup_event)) {
ep_rt_wait_event_set (&_server_resume_runtime_startup_event);
_is_paused_for_startup = false;
_is_paused_for_startup = false;
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/native/eventpipe/ep-rt.h
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,10 @@ ep_rt_thread_create (
EventPipeThreadType thread_type,
void *id);

static
void
ep_rt_set_server_name (void);

static
void
ep_rt_thread_sleep (uint64_t ns);
Expand Down
8 changes: 8 additions & 0 deletions src/native/libs/System.Native/pal_signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,14 @@ static void* SignalHandlerLoop(void* arg)
free(arg);
assert(pipeFd >= 0);

char* threadName = ".NET SigHandler";
#if defined(__linux__) || defined(__FreeBSD__)
pthread_setname_np(pthread_self(), threadName);
#endif
#if defined(__APPLE__)
pthread_setname_np(threadName);
#endif

// Continually read a signal code from the signal pipe and process it,
// until the pipe is closed.
while (true)
Expand Down