From 07c55ef047a954debc8161ac9249a3fd28bbf377 Mon Sep 17 00:00:00 2001 From: Manoj Kasichainula Date: Tue, 3 Aug 1999 20:41:37 +0000 Subject: [PATCH] No reason to have a loop writing one byte at a time to the pipe of death when the write call will do it for us. Also fix the comments a bit. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@83562 13f79535-47bb-0310-9956-ffa450edef68 --- server/mpm/dexter/dexter.c | 8 +++----- server/mpm/mpmt_pthread/mpmt_pthread.c | 10 +++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/server/mpm/dexter/dexter.c b/server/mpm/dexter/dexter.c index a680efb189..55b0c01951 100644 --- a/server/mpm/dexter/dexter.c +++ b/server/mpm/dexter/dexter.c @@ -1419,11 +1419,9 @@ int ap_mpm_run(pool *_pconf, pool *plog, server_rec *s) ap_scoreboard_image[i].status = SERVER_DYING; } } - /* kill off the idle ones */ - for (i = 0; i < num_daemons; ++i) { - if (write(pipe_of_death[1], &char_of_death, 1) == -1) { - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "write pipe_of_death"); - } + /* give the children the signal to die */ + if (write(pipe_of_death[1], &char_of_death, num_daemons) == -1) { + ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, "write pipe_of_death"); } } else { diff --git a/server/mpm/mpmt_pthread/mpmt_pthread.c b/server/mpm/mpmt_pthread/mpmt_pthread.c index 33b57491d6..e8cf350ab4 100644 --- a/server/mpm/mpmt_pthread/mpmt_pthread.c +++ b/server/mpm/mpmt_pthread/mpmt_pthread.c @@ -1469,11 +1469,11 @@ int ap_mpm_run(pool *_pconf, pool *plog, server_rec *s) ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, server_conf, "SIGWINCH received. Doing graceful restart"); - /* kill off the idle ones */ - for (i = 0; i < ap_daemons_limit; ++i) { - if (write(pipe_of_death[1], &char_of_death, 1) == -1) { - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "write pipe_of_death"); - } + /* give the children the signal to die. Sending more bytes than + * children is okay, because the pipe is recreated for every + * generation */ + if (write(pipe_of_death[1], &char_of_death, ap_daemons_limit) == -1) { + ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "write pipe_of_death"); } /* This is mostly for debugging... so that we know what is still -- 2.50.1