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
f96c16ae
Commit
f96c16ae
authored
Feb 26, 2012
by
Charles-François Natali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #14107: test: Fix a deadlock involving the memory watchdog thread.
parent
0b9d21d3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
Lib/test/support.py
Lib/test/support.py
+10
-0
No files found.
Lib/test/support.py
View file @
f96c16ae
...
...
@@ -45,6 +45,11 @@ try:
except
ImportError
:
zlib
=
None
try
:
import
fcntl
except
ImportError
:
fcntl
=
None
__all__
=
[
"Error"
,
"TestFailed"
,
"ResourceDenied"
,
"import_module"
,
"verbose"
,
"use_resources"
,
"max_memuse"
,
"record_original_stdout"
,
...
...
@@ -1184,6 +1189,11 @@ class _MemoryWatchdog:
sys
.
stderr
.
flush
()
return
pipe_fd
,
wfd
=
os
.
pipe
()
# set the write end of the pipe non-blocking to avoid blocking the
# watchdog thread when the consumer doesn't drain the pipe fast enough
if
fcntl
:
flags
=
fcntl
.
fcntl
(
wfd
,
fcntl
.
F_GETFL
)
fcntl
.
fcntl
(
wfd
,
fcntl
.
F_SETFL
,
flags
|
os
.
O_NONBLOCK
)
# _file_watchdog() doesn't take the GIL in its child thread, and
# therefore collects statistics timely
faulthandler
.
_file_watchdog
(
rfd
,
wfd
,
1.0
)
...
...
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