diff --git a/include/haproxy/defaults.h b/include/haproxy/defaults.h index 6dc5167d8..a8e5e5780 100644 --- a/include/haproxy/defaults.h +++ b/include/haproxy/defaults.h @@ -34,10 +34,6 @@ #define MAX_THREADS_PER_GROUP 1 #else -/* threads enabled, max_threads defaults to long bits */ -#ifndef MAX_THREADS -#define MAX_THREADS LONGBITS -#endif /* theoretical limit is 64, though we'd rather not push it too far for now * as some structures might be enlarged to be indexed per group. Let's start @@ -48,9 +44,18 @@ #ifndef MAX_TGROUPS #define MAX_TGROUPS 16 #endif + #define MAX_THREADS_PER_GROUP LONGBITS + +/* threads enabled, max_threads defaults to long bits for 1 tgroup or 4 times + * long bits if more tgroups are enabled. + */ +#ifndef MAX_THREADS +#define MAX_THREADS ((((MAX_TGROUPS) > 1) ? 4 : 1) * (MAX_THREADS_PER_GROUP)) #endif +#endif // USE_THREAD + /* * BUFSIZE defines the size of a read and write buffer. It is the maximum * amount of bytes which can be stored by the proxy for each stream. However,