From 82196eb74e5b631d718e9893582ce4b57d13d4d6 Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Tue, 13 Jan 2026 11:42:32 +0100 Subject: [PATCH] BUG/MEDIUM: threads: Fix binding thread on bind. The code to parse the "thread" keyword on bind lines was changed to check if the thread numbers were correct against the value provided with max-threads-per-group, if any were provided, however, at the time those thread keywords have been set, it may not yet have been set, and that breaks the feature, so revert to check against MAX_THREADS_PER_GROUP instead, it should have no major impact. --- src/thread.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/thread.c b/src/thread.c index 80b84018a..279e4f0e4 100644 --- a/src/thread.c +++ b/src/thread.c @@ -1874,7 +1874,7 @@ int parse_thread_set(const char *arg, struct thread_set *ts, char **err) if (!*set) { /* empty set sets no restriction */ min = 1; - max = is_rel ? global.maxthrpertgroup : MAX_THREADS; + max = is_rel ? MAX_THREADS_PER_GROUP : MAX_THREADS; } else { if (sep != set && *sep && *sep != '-' && *sep != ',') { @@ -1902,9 +1902,9 @@ int parse_thread_set(const char *arg, struct thread_set *ts, char **err) max = min = 0; // throw an error below } - if (min < 1 || min > MAX_THREADS || (is_rel && min > global.maxthrpertgroup)) { + if (min < 1 || min > MAX_THREADS || (is_rel && min > MAX_THREADS_PER_GROUP)) { memprintf(err, "invalid first thread number '%s', permitted range is 1..%d, or 'all', 'odd', 'even'.", - set, is_rel ? global.maxthrpertgroup : MAX_THREADS); + set, is_rel ? MAX_THREADS_PER_GROUP : MAX_THREADS); return -1; } @@ -1921,15 +1921,15 @@ int parse_thread_set(const char *arg, struct thread_set *ts, char **err) v = atoi(set); if (sep == set) { // no digit: to the max - max = is_rel ? global.maxthrpertgroup : MAX_THREADS; + max = is_rel ? MAX_THREADS_PER_GROUP : MAX_THREADS; if (*sep && *sep != ',') max = 0; // throw an error below } else max = v; - if (max < 1 || max > MAX_THREADS || (is_rel && max > global.maxthrpertgroup)) { + if (max < 1 || max > MAX_THREADS || (is_rel && max > MAX_THREADS_PER_GROUP)) { memprintf(err, "invalid last thread number '%s', permitted range is 1..%d.", - set, is_rel ? global.maxthrpertgroup : MAX_THREADS); + set, is_rel ? MAX_THREADS_PER_GROUP : MAX_THREADS); return -1; } }