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.
This commit is contained in:
Willy Tarreau 2019-05-21 15:14:08 +02:00
parent 9c8800af3b
commit 663fda4c90
1 changed files with 2 additions and 0 deletions

View File

@ -2498,10 +2498,12 @@ static void *run_thread_poll_loop(void *data)
ha_set_tid((unsigned long)data); ha_set_tid((unsigned long)data);
#if defined(_POSIX_TIMERS) && defined(_POSIX_THREAD_CPUTIME)
#ifdef USE_THREAD #ifdef USE_THREAD
pthread_getcpuclockid(pthread_self(), &ti->clock_id); pthread_getcpuclockid(pthread_self(), &ti->clock_id);
#else #else
ti->clock_id = CLOCK_THREAD_CPUTIME_ID; ti->clock_id = CLOCK_THREAD_CPUTIME_ID;
#endif
#endif #endif
tv_update_date(-1,-1); tv_update_date(-1,-1);