]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: threads/init: synchronize the threads startup
authorWilly Tarreau <w@1wt.eu>
Mon, 20 May 2019 08:50:43 +0000 (10:50 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 20 May 2019 09:26:12 +0000 (11:26 +0200)
commit3078e9f8e24c873fdbdc89663c210ed795987467
tree7ffe2d2d632d693b9d48b75b51015141b8987b3a
parent7b302d8dd54e84cf68ff189936fbf96121dbd603
MINOR: threads/init: synchronize the threads startup

It's a bit dangerous to let threads initialize at different speeds on
startup. Some are still in their init functions while others area already
running. It was even subject to some race condition bugs like the one
fixed by commit 1605c7ae6 ("BUG/MEDIUM: threads/mworker: fix a race on
startup").

Here in order to secure all this, we take a very simplistic approach
consisting in using half of the rendez-vous point, which is made
exactly for this purpose : we first initialize the mask of the threads
requesting a rendez-vous to the mask of all threads, and we simply call
thread_release() once the init is complete. This guarantees that no
thread will go further than the initialization code during this time.

This could even safely be backported if any other issue related to an
init race was discovered in a stable release.
src/haproxy.c