mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-01-29 14:01:50 +01:00
When a frequency counter must be updated, we use the curr_sec/curr_tick fields as a lock, by setting the MSB to 1 in a compare-and-swap to lock and by reseting it to unlock. And when we need to read it, we loop until the counter is unlocked. This way, the frequency counters are thread-safe without any external lock. It is important to avoid increasing the size of many structures (global, proxy, server, stick_table).