Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
5121debe
Commit
5121debe
authored
Oct 20, 2013
by
Charles-François Natali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #19310: asyncio: fix child processes reaping logic.
parent
e5a3154c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
17 deletions
+19
-17
Lib/asyncio/unix_events.py
Lib/asyncio/unix_events.py
+19
-17
No files found.
Lib/asyncio/unix_events.py
View file @
5121debe
...
...
@@ -167,23 +167,25 @@ class SelectorEventLoop(selector_events.BaseSelectorEventLoop):
def
_sig_chld
(
self
):
try
:
try
:
pid
,
status
=
os
.
waitpid
(
-
1
,
os
.
WNOHANG
)
except
ChildProcessError
:
return
if
pid
==
0
:
self
.
call_soon
(
self
.
_sig_chld
)
return
elif
os
.
WIFSIGNALED
(
status
):
returncode
=
-
os
.
WTERMSIG
(
status
)
elif
os
.
WIFEXITED
(
status
):
returncode
=
os
.
WEXITSTATUS
(
status
)
else
:
self
.
call_soon
(
self
.
_sig_chld
)
return
transp
=
self
.
_subprocesses
.
get
(
pid
)
if
transp
is
not
None
:
transp
.
_process_exited
(
returncode
)
# because of signal coalescing, we must keep calling waitpid() as
# long as we're able to reap a child
while
True
:
try
:
pid
,
status
=
os
.
waitpid
(
-
1
,
os
.
WNOHANG
)
except
ChildProcessError
:
break
if
pid
==
0
:
break
elif
os
.
WIFSIGNALED
(
status
):
returncode
=
-
os
.
WTERMSIG
(
status
)
elif
os
.
WIFEXITED
(
status
):
returncode
=
os
.
WEXITSTATUS
(
status
)
else
:
# shouldn't happen
continue
transp
=
self
.
_subprocesses
.
get
(
pid
)
if
transp
is
not
None
:
transp
.
_process_exited
(
returncode
)
except
Exception
:
logger
.
exception
(
'Unknown exception in SIGCHLD handler'
)
...
...
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