From: Willy Tarreau Date: Tue, 21 May 2019 13:14:08 +0000 (+0200) Subject: BUILD: threads: only assign the clock_id when supported X-Git-Tag: v2.0-dev4~41 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=663fda4c90f4ba86d4ba24e9a07b3bdd4ca7f062;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/src/haproxy.c b/src/haproxy.c index eae096577f..76d2aa0bf5 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);