]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: threads: make MAX_THREADS configurable at build time
authorWilly Tarreau <w@1wt.eu>
Sat, 26 Jan 2019 12:35:03 +0000 (13:35 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 26 Jan 2019 12:37:48 +0000 (13:37 +0100)
commitf5809cde7a7412caeb01fc7852e392dec1a3296a
tree572b0b56deca473642aed64e1ccc399ca0b344a5
parentc9a82e48bfd2a8af8b8025c012910c9c56b9cc87
MINOR: threads: make MAX_THREADS configurable at build time

There's some value in being able to limit MAX_THREADS, either to save
precious resources in embedded environments, or to protect certain
deployments against accidently incorrect settings.

With this patch, if MAX_THREADS is defined at build time, it will be
used. However, given that LONGBITS is not a macro but is defined
according to sizeof(long), we can't check the value range at build
time and instead we need to perform the check at early boot time.
However, the compiler is able to optimize away the constant comparisons
and doesn't even emit the check code when values are correct.

The output message regarding threading support was improved to report
the number of threads.
include/common/hathreads.h
src/hathreads.c