From 0b3d21ae6b00c0f027c4f69a93d3f2215511c764 Mon Sep 17 00:00:00 2001 From: Hyungju Lee Date: Wed, 7 Sep 2022 18:07:47 +0900 Subject: [PATCH] Set name .NET SigHandler --- src/native/libs/System.Native/pal_signal.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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)