Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
3adaf8db
Commit
3adaf8db
authored
Oct 07, 2013
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reaping zombies properly
parent
1777cc6e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
main.c
build/main.c
+7
-0
No files found.
build/main.c
View file @
3adaf8db
...
@@ -78,11 +78,15 @@ static struct mg_context *ctx; // Set by start_mongoose()
...
@@ -78,11 +78,15 @@ static struct mg_context *ctx; // Set by start_mongoose()
#endif
/* !CONFIG_FILE */
#endif
/* !CONFIG_FILE */
static
void
WINCDECL
signal_handler
(
int
sig_num
)
{
static
void
WINCDECL
signal_handler
(
int
sig_num
)
{
// Reinstantiate signal handler
signal
(
sig_num
,
signal_handler
);
#if !defined(_WIN32)
#if !defined(_WIN32)
// Do not do the trick with ignoring SIGCHLD, cause not all OSes (e.g. QNX)
// Do not do the trick with ignoring SIGCHLD, cause not all OSes (e.g. QNX)
// reap zombies if SIGCHLD is ignored. On QNX, for example, waitpid()
// reap zombies if SIGCHLD is ignored. On QNX, for example, waitpid()
// fails if SIGCHLD is ignored, making system() non-functional.
// fails if SIGCHLD is ignored, making system() non-functional.
if
(
sig_num
==
SIGCHLD
)
{
if
(
sig_num
==
SIGCHLD
)
{
printf
(
"dssfdsfds
\n
"
);
do
{}
while
(
waitpid
(
-
1
,
&
sig_num
,
WNOHANG
)
>
0
);
do
{}
while
(
waitpid
(
-
1
,
&
sig_num
,
WNOHANG
)
>
0
);
}
else
}
else
#endif
#endif
...
@@ -383,6 +387,9 @@ static void start_mongoose(int argc, char *argv[]) {
...
@@ -383,6 +387,9 @@ static void start_mongoose(int argc, char *argv[]) {
// Setup signal handler: quit on Ctrl-C
// Setup signal handler: quit on Ctrl-C
signal
(
SIGTERM
,
signal_handler
);
signal
(
SIGTERM
,
signal_handler
);
signal
(
SIGINT
,
signal_handler
);
signal
(
SIGINT
,
signal_handler
);
#ifndef _WIN32
signal
(
SIGCHLD
,
signal_handler
);
#endif
// Start Mongoose
// Start Mongoose
ctx
=
mg_start
((
const
char
**
)
options
,
event_handler
,
NULL
);
ctx
=
mg_start
((
const
char
**
)
options
,
event_handler
,
NULL
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment