diff options
author | Ben Gamari <ben@smart-cactus.org> | 2021-04-02 10:51:53 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-04-05 20:45:46 -0400 |
commit | bfe8ef8e577a41ce9f29cb5f7879368f5e4b5897 (patch) | |
tree | 4cbdb76a3f126d50179739c0ccd61d387b1a73b6 /rts/posix | |
parent | eac9d3764a35b6c219d74d750bad9d8e790cff77 (diff) | |
download | haskell-bfe8ef8e577a41ce9f29cb5f7879368f5e4b5897.tar.gz |
rts: Fix usage of pthread_setname_np
Previously we used this non-portable function unconditionally, breaking
FreeBSD.
Fixes #19637.
Diffstat (limited to 'rts/posix')
-rw-r--r-- | rts/posix/OSThreads.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/rts/posix/OSThreads.c b/rts/posix/OSThreads.c index 200a4ccdad..b815894a9f 100644 --- a/rts/posix/OSThreads.c +++ b/rts/posix/OSThreads.c @@ -30,7 +30,7 @@ #if defined(HAVE_PTHREAD_H) #include <pthread.h> -#if defined(freebsd_HOST_OS) +#if defined(HAVE_PTHREAD_NP_H) #include <pthread_np.h> #endif #endif @@ -153,8 +153,12 @@ createOSThread (OSThreadId* pId, char *name STG_UNUSED, int result = pthread_create(pId, NULL, startProc, param); if (!result) { pthread_detach(*pId); -#if defined(HAVE_PTHREAD_SETNAME_NP) +#if defined(HAVE_PTHREAD_SET_NAME_NP) + pthread_set_name_np(*pId, name); +#elif defined(HAVE_PTHREAD_SETNAME_NP) pthread_setname_np(*pId, name); +#elif defined(HAVE_PTHREAD_SETNAME_NP_DARWIN) + pthread_setname_np(name); #endif } return result; |