mirror of
https://github.com/cesanta/mongoose.git
synced 2024-12-26 22:41:03 +08:00
Ignoring SIGCHLD to let OS reap the zombies.
This commit is contained in:
parent
9e524a2fce
commit
8942a4cdad
@ -2993,9 +2993,6 @@ static void handle_cgi_request(struct mg_connection *conn, const char *prog) {
|
||||
done:
|
||||
if (pid != (pid_t) -1) {
|
||||
kill(pid, SIGKILL);
|
||||
#if !defined(_WIN32)
|
||||
do {} while (waitpid(-1, &i, WNOHANG) > 0);
|
||||
#endif
|
||||
}
|
||||
if (fd_stdin[0] != -1) {
|
||||
(void) close(fd_stdin[0]);
|
||||
@ -4133,6 +4130,8 @@ struct mg_context *mg_start(mg_callback_t user_callback, void *user_data,
|
||||
// Ignore SIGPIPE signal, so if browser cancels the request, it
|
||||
// won't kill the whole process.
|
||||
(void) signal(SIGPIPE, SIG_IGN);
|
||||
// Also ignoring SIGCHLD to let the OS to reap zombies properly.
|
||||
(void) signal(SIGCHLD, SIG_IGN);
|
||||
#endif // !_WIN32
|
||||
|
||||
(void) pthread_mutex_init(&ctx->mutex, NULL);
|
||||
|
@ -88,6 +88,11 @@ typedef void * (*mg_callback_t)(enum mg_event event,
|
||||
// options: NULL terminated list of option_name, option_value pairs that
|
||||
// specify Mongoose configuration parameters.
|
||||
//
|
||||
// Side-effects: on UNIX, ignores SIGCHLD and SIGPIPE signals. If custom
|
||||
// processing is required for these, signal handlers must be set up
|
||||
// after calling mg_start().
|
||||
//
|
||||
//
|
||||
// Example:
|
||||
// const char *options[] = {
|
||||
// "document_root", "/var/www",
|
||||
|
Loading…
x
Reference in New Issue
Block a user