MINOR: clock: always use atomic ops for global_now_ms
authorAurelien DARRAGON <adarragon@haproxy.com>
Wed, 19 Feb 2025 10:42:04 +0000 (11:42 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 28 Feb 2025 15:22:49 +0000 (16:22 +0100)
commite5057a90eb505d3a8f98d655bf669e6943a62861
tree1ed9ed431b8e189aad422a1a87eab0ec578bb503
parent0164f13cb144fff527b970a6f19175ccd627980c
MINOR: clock: always use atomic ops for global_now_ms

global_now_ms is shared between threads so we must give hint to the
compiler that read/writes operations should be performed atomically.

Everywhere global_now_ms was used, atomic ops were used, except in
clock_update_global_date() where a read was performed without using
atomic op. In practise it is not an issue because on most systems
such reads should be atomic already, but to prevent any confusion or
potential bug on exotic systems, let's use an explicit _HA_ATOMIC_LOAD
there.

This may be backported up to 2.8

(cherry picked from commit 97a19517ffe3438562f80c314f5b6f3f27df7668)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
src/clock.c