diff options
author | Viktor Dukhovni <ietf-dane@dukhovni.org> | 2021-04-19 04:02:33 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-04-22 17:00:55 -0400 |
commit | aa685c50d575ccf6c46a89d4ecdc9cffcf8b73f4 (patch) | |
tree | 29bd281a842b6dd355222c46cd866d61fee7b9e6 /rts/posix | |
parent | 350f4f61ae847c8adf376b9ca49ad1fee64e2e95 (diff) | |
download | haskell-aa685c50d575ccf6c46a89d4ecdc9cffcf8b73f4.tar.gz |
Add background note in elf_tlsgd.c.
Also some code cleanup, and a fix for an (extant unrelated) missing
<pthread_np.h> include that should hopefully resolve a failure in the
FreeBSD CI build, since it is best to make sure that this MR actually
builds on FreeBSD systems other than mine.
Some unexpected metric changes on FreeBSD (perhaps because CI had been
failing for a while???):
Metric Decrease:
T3064
T5321Fun
T5642
T9020
T12227
T13253-spj
T15164
T18282
WWRec
Metric Increase:
haddock.compiler
Diffstat (limited to 'rts/posix')
-rw-r--r-- | rts/posix/itimer/Pthread.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/rts/posix/itimer/Pthread.c b/rts/posix/itimer/Pthread.c index 82379b9172..438bc2f69c 100644 --- a/rts/posix/itimer/Pthread.c +++ b/rts/posix/itimer/Pthread.c @@ -63,6 +63,9 @@ #include <string.h> #include <pthread.h> +#if defined(HAVE_PTHREAD_NP_H) +#include <pthread_np.h> +#endif #include <unistd.h> #include <fcntl.h> @@ -175,10 +178,20 @@ initTicker (Time interval, TickProc handle_tick) /* * We can't use the RTS's createOSThread here as we need to remain attached * to the thread we create so we can later join to it if requested + * + * On FreeBSD 12.2 pthread_set_name_np() is unconditionally declared in + * <pthread_np.h>, while pthread_setname_np() is conditionally declared in + * <pthread.h> when _POSIX_SOURCE is not defined, but we're including + * <PosixSource.h>, so must use pthread_set_name_np() instead. See similar + * code in "rts/posix/OSThreads.c". */ if (! pthread_create(&thread, NULL, itimer_thread_func, (void*)handle_tick)) { -#if defined(HAVE_PTHREAD_SETNAME_NP) +#if defined(HAVE_PTHREAD_SET_NAME_NP) + pthread_set_name_np(thread, "ghc_ticker"); +#elif defined(HAVE_PTHREAD_SETNAME_NP) pthread_setname_np(thread, "ghc_ticker"); +#elif defined(HAVE_PTHREAD_SETNAME_NP_DARWIN) + pthread_setname_np("ghc_ticker"); #endif } else { barf("Itimer: Failed to spawn thread: %s", strerror(errno)); |