]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: threads: Fix the exit condition of the thread barrier
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 20 Jul 2018 07:31:53 +0000 (09:31 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 20 Jul 2018 12:24:41 +0000 (14:24 +0200)
commitddb6c16576e92b75db699c265645431cc916d4b8
treeda965130018bdecf2030af1536af326d00923311
parent20761453fb985d02cddf0f1b0566ae037195b52e
BUG/MEDIUM: threads: Fix the exit condition of the thread barrier

In thread_sync_barrier, we exit when all threads have set their own bit in the
barrier mask. It is done by comparing it to all_threads_mask. But we must not
use a simple equality to do so, becaue all_threads_mask may change. Since commit
ba86c6c25 ("MINOR: threads: Be sure to remove threads from all_threads_mask on
exit"), when a thread exit, its bit is removed from all_threads_mask. Instead,
we must use a bitwise AND to test is all bits of all_threads_mask are set.

This also requires that all_threads_mask is set to volatile if we want to
catch changes.

This patch must be backported in 1.8.
include/common/hathreads.h
src/hathreads.c