mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 07:37:02 +02:00
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
This commit is contained in:
parent
9561b9fb69
commit
97a19517ff
@ -270,7 +270,7 @@ void clock_update_global_date()
|
||||
* otherwise catch up.
|
||||
*/
|
||||
old_now_ns = _HA_ATOMIC_LOAD(&global_now_ns);
|
||||
old_now_ms = global_now_ms;
|
||||
old_now_ms = _HA_ATOMIC_LOAD(&global_now_ms);
|
||||
|
||||
do {
|
||||
if (now_ns < old_now_ns)
|
||||
|
Loading…
Reference in New Issue
Block a user