mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-26 20:38:25 +00:00
Moved SIGCHLD handler out of mongoose.c. Embedded user must set SIGCHLD handler if CGI is used.
This commit is contained in:
1 parent
e556a487e0
commit
73d2b395d1
3 files changed
+9
-4
No files matched your search
@@ -375,6 +375,11 @@ static void start_mongoose(int argc, char *argv[]) {
|
|||||||
signal(SIGTERM, signal_handler);
|
signal(SIGTERM, signal_handler);
|
||||||
signal(SIGINT, signal_handler);
|
signal(SIGINT, signal_handler);
|
||||||
|
|
||||||
|
#if !defined(_WIN32)
|
||||||
|
// Also ignoring SIGCHLD to let the OS to reap zombies properly.
|
||||||
|
(void) signal(SIGCHLD, SIG_IGN);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Start Mongoose
|
// Start Mongoose
|
||||||
memset(&callbacks, 0, sizeof(callbacks));
|
memset(&callbacks, 0, sizeof(callbacks));
|
||||||
callbacks.log_message = &log_message;
|
callbacks.log_message = &log_message;
|
||||||
|
|||||||
@@ -5452,8 +5452,6 @@ struct mg_context *mg_start(const struct mg_callbacks *callbacks,
|
|||||||
// Ignore SIGPIPE signal, so if browser cancels the request, it
|
// Ignore SIGPIPE signal, so if browser cancels the request, it
|
||||||
// won't kill the whole process.
|
// won't kill the whole process.
|
||||||
(void) signal(SIGPIPE, SIG_IGN);
|
(void) signal(SIGPIPE, SIG_IGN);
|
||||||
// Also ignoring SIGCHLD to let the OS to reap zombies properly.
|
|
||||||
(void) signal(SIGCHLD, SIG_IGN);
|
|
||||||
#endif // !_WIN32
|
#endif // !_WIN32
|
||||||
|
|
||||||
(void) pthread_mutex_init(&ctx->mutex, NULL);
|
(void) pthread_mutex_init(&ctx->mutex, NULL);
|
||||||
|
|||||||
+4
-2
@@ -142,10 +142,12 @@ struct mg_callbacks {
|
|||||||
// options: NULL terminated list of option_name, option_value pairs that
|
// options: NULL terminated list of option_name, option_value pairs that
|
||||||
// specify Mongoose configuration parameters.
|
// specify Mongoose configuration parameters.
|
||||||
//
|
//
|
||||||
// Side-effects: on UNIX, ignores SIGCHLD and SIGPIPE signals. If custom
|
// Side-effects: on UNIX, ignores SIGPIPE signals. If custom
|
||||||
// processing is required for these, signal handlers must be set up
|
// processing is required SIGPIPE, signal handler must be set up
|
||||||
// after calling mg_start().
|
// after calling mg_start().
|
||||||
//
|
//
|
||||||
|
// Important: Mongoose does not install SIGCHLD handler. If CGI is used,
|
||||||
|
// SIGCHLD handler must be set up to reap CGI zombie processes.
|
||||||
//
|
//
|
||||||
// Example:
|
// Example:
|
||||||
// const char *options[] = {
|
// const char *options[] = {
|
||||||
|
|||||||
Reference in new issue
Block a user