]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MAJOR: threads/freq_ctr: use a memory barrier to detect changes
authorWilly Tarreau <w@1wt.eu>
Tue, 31 Oct 2017 16:54:15 +0000 (17:54 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 31 Oct 2017 17:01:18 +0000 (18:01 +0100)
commita06a580941002f77fba182fd9d922670c7e2c5fc
tree9d0a9d4353a1b3b729b91b26259e80898e9459a1
parentb29dc95a9748732898996540768bbed7a01f9a03
BUG/MAJOR: threads/freq_ctr: use a memory barrier to detect changes

commit 6e01286 (BUG/MAJOR: threads/freq_ctr: fix lock on freq counters)
attempted to fix the loop using volatile but that doesn't work depending
on the level of optimization, resulting in situations where the threads
could remain looping forever. Here we use memory barriers between reads
to enforce a strict ordering and the asm code produced does exactly what
the C code does and works perfectly, with a 3-digit measurement accuracy
observed during a test.
src/freq_ctr.c