]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: threads: only assign the clock_id when supported
authorWilly Tarreau <w@1wt.eu>
Tue, 21 May 2019 13:14:08 +0000 (15:14 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 21 May 2019 13:14:08 +0000 (15:14 +0200)
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

index eae096577f9409582a273fb4d3daa8e01ae73d38..76d2aa0bf58eed0254e44ca1f88749b06f9c7052 100644 (file)
@@ -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);