uh_start_worker: Improve

The child process is only created when the number of workers is greater than 1

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
main^2
Jianhui Zhao 2021-01-03 17:38:36 +08:00
parent 143e0d8abe
commit c11052e302
1 changed files with 4 additions and 2 deletions

View File

@ -145,7 +145,9 @@ static void uh_start_worker(struct uh_server *srv, int n)
if (n < 0) if (n < 0)
n = get_nprocs(); n = get_nprocs();
if (n > 0) if (n < 2)
return;
uh_stop_accept(srvi); uh_stop_accept(srvi);
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {