Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
8412311e
Commit
8412311e
authored
Dec 16, 2016
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clarify documentation on dependencies of monkey-patched os/signal and the event loop. [skip ci]
parent
1c9264f8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
+15
-7
src/gevent/monkey.py
src/gevent/monkey.py
+15
-7
No files found.
src/gevent/monkey.py
View file @
8412311e
...
...
@@ -12,10 +12,11 @@ behave in the same way as the original (at least as closely as possible).
The primary interface to this is the :func:`patch_all` function, which
performs all the available patches. It accepts arguments to limit the
patching to certain modules, but most programs will want to use the
default values as they receive the most wide-spread testing.
patching to certain modules, but most programs **should** use the
default values as they receive the most wide-spread testing, and some monkey
patches have dependencies on others.
Patching *
should be done as early as possible
* in the lifecycle of the
Patching *
*should be done as early as possible*
* in the lifecycle of the
program. For example, the main module (the one that tests against
``__main__`` or is otherwise the first imported) should begin with
this code, ideally before any other imports::
...
...
@@ -217,8 +218,12 @@ def patch_os():
environment variable ``GEVENT_NOWAITPID`` is not defined). Does
nothing if fork is not available.
This method must be used with :func:`patch_signal` to have proper SIGCHLD
handling. :func:`patch_all` calls both by default.
.. caution:: This method must be used with :func:`patch_signal` to have proper SIGCHLD
handling and thus correct results from ``waitpid``.
:func:`patch_all` calls both by default.
.. caution:: For SIGCHLD handling to work correctly, the event loop must run.
The easiest way to help ensure this is to use :func:`patch_all`.
"""
patch_module
(
'os'
)
...
...
@@ -551,9 +556,12 @@ def patch_signal():
"""
Make the signal.signal function work with a monkey-patched os.
This method must be used with :func:`patch_os` to have proper SIGCHLD
.. caution::
This method must be used with :func:`patch_os` to have proper SIGCHLD
handling. :func:`patch_all` calls both by default.
.. caution:: For proper SIGCHLD handling, you must yield to the event loop.
Using :func:`patch_all` is the easiest way to ensure this.
.. seealso:: :mod:`gevent.signal`
"""
patch_module
(
"signal"
)
...
...
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