diff --git a/src/native/libs/System.Native/pal_signal.c b/src/native/libs/System.Native/pal_signal.c index 0271f8c216ff05..b73898359083cc 100644 --- a/src/native/libs/System.Native/pal_signal.c +++ b/src/native/libs/System.Native/pal_signal.c @@ -313,6 +313,14 @@ static void* SignalHandlerLoop(void* arg) free(arg); assert(pipeFd >= 0); +#if defined(__linux__) || defined(__FreeBSD__) + pthread_setname_np(pthread_self(), ".NET SigHandler"); +#endif +#if defined(__APPLE__) + // on macOS, pthread_setname_np only works for the calling thread. + pthread_setname_np(".NET SigHandler"); +#endif + // Continually read a signal code from the signal pipe and process it, // until the pipe is closed. while (true)