]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: time: make sure only one thread sets global_now at boot
authorWilly Tarreau <w@1wt.eu>
Thu, 6 Jun 2019 14:50:39 +0000 (16:50 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 6 Jun 2019 14:50:39 +0000 (16:50 +0200)
commit43091ed161e1013feb7efb07a50b04dda6546bf9
treeaa905c2f4c593f5524bb2b24a11622afa42f1ea6
parent237f8aef41a2607cfa80b5c80c1a6e049c3114dc
BUG/MINOR: time: make sure only one thread sets global_now at boot

All threads call tv_update_date(-1) at boot to set their own local time
offset. While doing so they also overwrite global_now, which is not that
much of a problem except that it's not done using an atomic write and
that it will be overwritten by every there in parallel. We only need the
first thread to set it anyway, so let's simply set it if not set and do
it using a CAS. This should fix GH issue #111.

This may be backported to 1.9.
src/time.c