From 663fda4c90f4ba86d4ba24e9a07b3bdd4ca7f062 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 21 May 2019 15:14:08 +0200 Subject: [PATCH] BUILD: threads: only assign the clock_id when supported I took extreme care to always check for _POSIX_THREAD_CPUTIME before manipulating clock_id, except at one place (run_thread_poll_loop) as found by Manu, breaking Solaris. Now fixed, no backport needed. --- src/haproxy.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/haproxy.c b/src/haproxy.c index eae096577..76d2aa0bf 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -2498,10 +2498,12 @@ static void *run_thread_poll_loop(void *data) ha_set_tid((unsigned long)data); +#if defined(_POSIX_TIMERS) && defined(_POSIX_THREAD_CPUTIME) #ifdef USE_THREAD pthread_getcpuclockid(pthread_self(), &ti->clock_id); #else ti->clock_id = CLOCK_THREAD_CPUTIME_ID; +#endif #endif tv_update_date(-1,-1);