]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: thread: add a new per-thread flag TH_FL_NOTIFIED to remember wakeups
authorWilly Tarreau <w@1wt.eu>
Wed, 22 Jun 2022 13:38:38 +0000 (15:38 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 1 Jul 2022 17:15:14 +0000 (19:15 +0200)
commitdce4ad755f0cfac80b9f51ff06fcf0c7387b8693
tree432fdd2cb0184f2ea3968ba8d8ce214ab5775d4d
parent555c192d14ce0bf3caefc0b1b38959e6b6f858a8
MEDIUM: thread: add a new per-thread flag TH_FL_NOTIFIED to remember wakeups

Right now when an inter-thread wakeup happens, we preliminary check if the
thread was asleep, and if so we wake the poller up and remove its bit from
the sleeping mask. That's not very clean since the sleeping mask cannot be
entirely trusted since a thread that's about to wake up will already have
its sleeping bit removed.

This patch adds a new per-thread flag (TH_FL_NOTIFIED) to remember that a
thread was notified to wake up. It's cleared before checking the task lists
last, so that new wakeups can be considered again (since wake_thread() is
only used to notify about task wakeups and FD polling changes). This way
we do not need to modify a remote thread's sleeping mask anymore. As such
wake_thread() now only tests and sets the TH_FL_NOTIFIED flag but doesn't
clear sleeping anymore.
include/haproxy/fd.h
include/haproxy/tinfo-t.h
src/haproxy.c