mirror of
http://git.haproxy.org/git/haproxy.git
synced 2026-02-08 06:23:51 +02: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).