From: Willy Tarreau Date: Mon, 20 May 2019 18:23:06 +0000 (+0200) Subject: MINOR: threads: always place the clockid in the struct thread_info X-Git-Tag: v2.0-dev4~46 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=624dcbf41ec7aa4e6f39c906a4fc491f3d8d1a32;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/include/common/hathreads.h b/include/common/hathreads.h index 0dbec671d7..6c420dd3fa 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 692c333f0b..1c5898e935 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);