diff --git a/src/haproxy.c b/src/haproxy.c index f9564819e..2eb84bd87 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -833,8 +833,6 @@ static void mworker_loop() mworker_catch_sigchld(NULL); /* ensure we clean the children in case some SIGCHLD were lost */ - global.nbthread = 1; - jobs++; /* this is the "master" job, we want to take care of the signals even if there is no listener so the poll loop don't leave */ @@ -2076,6 +2074,16 @@ static void init(int argc, char **argv) LIST_APPEND(&proc_list, &tmproc->list); } + + if (global.mode & MODE_MWORKER_WAIT) { + /* in exec mode, there's always exactly one thread. Failure to + * set these ones now will result in nbthread being detected + * automatically. + */ + global.nbtgroups = 1; + global.nbthread = 1; + } + if (global.mode & (MODE_MWORKER|MODE_MWORKER_WAIT)) { struct wordlist *it, *c;