]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: threads: add a new function to resolve config groups and masks
authorWilly Tarreau <w@1wt.eu>
Wed, 29 Sep 2021 16:59:47 +0000 (18:59 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 8 Oct 2021 15:22:26 +0000 (17:22 +0200)
commit627def9e5061c609cda2ae6fd2ef0e5cbcba1f85
tree5418582b03961e4f8051e535403be346209e5c5b
parentd57b9ff7af73553a3d6930d6c75e8fdee3bf36f0
MINOR: threads: add a new function to resolve config groups and masks

In the configuration sometimes we'll omit a thread group number to designate
a global thread number range, and sometimes we'll mention the group and
designate IDs within that group. The operation is more complex than it
seems due to the need to check for ranges spanning between multiple groups
and determining groups from threads from bit masks and remapping bit masks
between local/global.

This patch adds a function to perform this operation, it takes a group and
mask on input and updates them on output. It's designed to be used by "bind"
lines but will likely be usable at other places if needed.

For situations where specified threads do not exist in the group, we have
the choice in the code between silently fixing the thread set or failing
with a message. For now the better option seems to return an error, but if
it turns out to be an issue we can easily change that in the future. Note
that it should only happen with "x/even" when group x only has one thread.
include/haproxy/thread.h
src/thread.c