]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
REORG: mworker: set nbthread=1 for master after fork
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Mon, 1 Jul 2024 12:10:14 +0000 (14:10 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 16 Oct 2024 20:02:39 +0000 (22:02 +0200)
After moving master-worker fork into init() and reintroducing it into a
switch-case (see the previous commit), it is more appropriate to set
nbthread=1 and nbtgroups=1 immediately in the 'case' for the parent process.

src/haproxy.c

index 686e16ac3a73a970325c811221e8c5a5c62358b6..3a89a281fa095c1680e610f088d603c733704388 100644 (file)
@@ -2096,15 +2096,6 @@ 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 daemon + mworker: must fork here to let a master process live in
         * background before forking children.
         */
@@ -2204,6 +2195,12 @@ static void init(int argc, char **argv)
                                                break;
                                }
                        }
+                       /* 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;
                }
        }