From 624dcbf41ec7aa4e6f39c906a4fc491f3d8d1a32 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Mon, 20 May 2019 20:23:06 +0200 Subject: [PATCH] MINOR: threads: always place the clockid in the struct thread_info It will be easier to deal with the internal API to always have it. --- include/common/hathreads.h | 1 + src/haproxy.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/include/common/hathreads.h b/include/common/hathreads.h index 0dbec671d..6c420dd3f 100644 --- a/include/common/hathreads.h +++ b/include/common/hathreads.h @@ -50,6 +50,7 @@ enum { tid_bit = 1UL }; enum { tid = 0 }; extern struct thread_info { + clockid_t clock_id; /* pad to cache line (64B) */ char __pad[0]; /* unused except to check remaining room */ char __end[0] __attribute__((aligned(64))); diff --git a/src/haproxy.c b/src/haproxy.c index 692c333f0..1c5898e93 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -2500,6 +2500,8 @@ static void *run_thread_poll_loop(void *data) #ifdef USE_THREAD pthread_getcpuclockid(pthread_self(), &thread_info[tid].clock_id); +#else + thread_info[tid].clock_id = CLOCK_THREAD_CPUTIME_ID; #endif tv_update_date(-1,-1);