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
62fa048a
Commit
62fa048a
authored
Mar 04, 2016
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Documentation. [skip ci]
parent
f44cd1c0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
1 deletion
+31
-1
doc/whatsnew_1_1.rst
doc/whatsnew_1_1.rst
+11
-0
gevent/monkey.py
gevent/monkey.py
+19
-1
gevent/os.py
gevent/os.py
+1
-0
No files found.
doc/whatsnew_1_1.rst
View file @
62fa048a
...
...
@@ -119,6 +119,11 @@ downstream libraries, notably `gunicorn`_.
:func:`gevent.os.waitpid` (again monkey patched by default) and
:func:`gevent.signal.signal` (which is monkey patched only for the
:data:`signal.SIGCHLD` case). The latter two patches are new in 1.1.
- In gevent 1.0, use of libev child watchers (which are used
internally by ``gevent.subprocess``) had race conditions with
user-provided ``SIGCHLD`` handlers, causing many types of
unpredictable breakage. The two new APIs described above are
intended to rectify this.
- Fork-watchers will be called, even in multi-threaded programs
(except on Windows).
- The default threadpool and threaded resolver work in child
...
...
@@ -138,6 +143,12 @@ possible in a monkey patched system, at least on POSIX platforms.
..
caution
::
It
is
not
possible
to
use
:
mod
:`
gevent
.
subprocess
`
from
native
threads
.
See
:
mod
:`
gevent
.
subprocess
`
for
details
.
..
note
::
If
the
``
SIGCHLD
``
signal
is
to
be
handled
,
it
is
important
to
monkey
patch
(
or
directly
use
)
both
:
mod
:`
os
`
and
:
mod
:`
signal
`;
this
is
the
default
for
:
func
:`~
gevent
.
monkey
.
patch_all
`.
Failure
to
do
so
can
result
in
the
``
SIGCHLD
``
signal
being
lost
.
..
tip
::
All
of
the
above
entail
forking
a
child
process
.
Forking
a
child
process
that
uses
gevent
,
greenlets
,
and
libev
can
have
some
unexpected
consequences
if
the
child
...
...
gevent/monkey.py
View file @
62fa048a
...
...
@@ -219,6 +219,9 @@ def patch_os():
:func:`os.waitpid` with :func:`gevent.os.waitpid` (if the
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.
"""
patch_module
(
'os'
)
...
...
@@ -515,6 +518,9 @@ 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
handling. :func:`patch_all` calls both by default.
.. seealso:: :mod:`gevent.signal`
"""
patch_module
(
"signal"
)
...
...
@@ -536,7 +542,19 @@ def _check_repatching(**module_settings):
def
patch_all
(
socket
=
True
,
dns
=
True
,
time
=
True
,
select
=
True
,
thread
=
True
,
os
=
True
,
ssl
=
True
,
httplib
=
False
,
subprocess
=
True
,
sys
=
False
,
aggressive
=
True
,
Event
=
False
,
builtins
=
True
,
signal
=
True
):
"""Do all of the default monkey patching (calls every other applicable function in this module)."""
"""
Do all of the default monkey patching (calls every other applicable
function in this module).
.. versionchanged:: 1.1
Issue a :mod:`warning <warnings>` if this function is called multiple times
with different arguments. The second and subsequent calls will only add more
patches, they can never remove existing patches by setting an argument to ``False``.
.. versionchanged:: 1.1
Issue a :mod:`warning <warnings>` if this function is called with ``os=False``
and ``signal=True``. This will cause SIGCHLD handlers to not be called. This may
be an error in the future.
"""
# Check to see if they're changing the patched list
_warnings
,
first_time
=
_check_repatching
(
**
locals
())
if
not
_warnings
and
not
first_time
:
...
...
gevent/os.py
View file @
62fa048a
...
...
@@ -210,6 +210,7 @@ if hasattr(os, 'fork'):
_waitpid
=
os
.
waitpid
_WNOHANG
=
os
.
WNOHANG
# replaced by the signal module.
_on_child_hook
=
lambda
:
None
# {pid -> watcher or tuple(pid, rstatus, timestamp)}
...
...
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