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
af93e655
Commit
af93e655
authored
Aug 07, 2015
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Documentation clarifications. [skip ci]
parent
58f94c59
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
14 deletions
+35
-14
gevent/greenlet.py
gevent/greenlet.py
+33
-12
gevent/hub.py
gevent/hub.py
+2
-2
No files found.
gevent/greenlet.py
View file @
af93e655
...
...
@@ -247,15 +247,27 @@ class Greenlet(greenlet):
return
bool
(
self
)
def
ready
(
self
):
"""Return true if and only if the greenlet has finished execution."""
"""
Return a true value if and only if the greenlet has finished
execution.
.. versionchanged:: 1.1
This function is only guaranteed to return true or false *values*, not
necessarily the literal constants ``True`` or ``False``.
"""
return
self
.
dead
or
self
.
_exc_info
def
successful
(
self
):
"""Return true if and only if the greenlet has finished execution successfully,
that is, without raising an error.
"""
Return a true value if and only if the greenlet has finished execution
successfully, that is, without raising an error.
.. tip:: A greenlet that has been killed with the default :class:`GreenletExit` exception
is considered successful. That is, ``GreenletExit`` is not considered an error.
.. tip:: A greenlet that has been killed with the default
:class:`GreenletExit` exception is considered successful.
That is, ``GreenletExit`` is not considered an error.
.. note:: This function is only guaranteed to return true or false *values*,
not necessarily the literal constants ``True`` or ``False``.
"""
return
self
.
_exc_info
and
self
.
_exc_info
[
1
]
is
None
...
...
@@ -371,7 +383,8 @@ class Greenlet(greenlet):
return
g
def
kill
(
self
,
exception
=
GreenletExit
,
block
=
True
,
timeout
=
None
):
"""Raise the ``exception`` in the greenlet.
"""
Raise the ``exception`` in the greenlet.
If ``block`` is ``True`` (the default), wait until the greenlet dies or the optional timeout expires.
If block is ``False``, the current greenlet is not unscheduled.
...
...
@@ -380,15 +393,23 @@ class Greenlet(greenlet):
.. note::
Depending on what this greenlet is executing and the state of the event loop,
the exception may or may not be raised immediately when this greenlet resumes
execution. It may be raised on a subsequent green call, or, if this greenlet
exits before making such a call, it may not be raised at all. As of 1.1, an example
where the exception is raised later is if this greenlet had called ``sleep(0)``; an
example where the exception is raised immediately is if this greenlet had called ``sleep(0.1)``.
Depending on what this greenlet is executing and the state
of the event loop, the exception may or may not be raised
immediately when this greenlet resumes execution. It may
be raised on a subsequent green call, or, if this greenlet
exits before making such a call, it may not be raised at
all. As of 1.1, an example where the exception is raised
later is if this greenlet had called :func:`sleep(0)
<gevent.sleep>`; an example where the exception is raised
immediately is if this greenlet had called
:func:`sleep(0.1) <gevent.sleep>`.
See also :func:`gevent.kill`.
:keyword type exception: The type of exception to raise in the greenlet. The default
is :class:`GreenletExit`, which indicates a :meth:`successful` completion
of the greenlet.
.. versionchanged:: 0.13.0
*block* is now ``True`` by default.
.. versionchanged:: 1.1a2
...
...
gevent/hub.py
View file @
af93e655
...
...
@@ -148,9 +148,9 @@ def kill(greenlet, exception=GreenletExit):
so you have to use this function.
.. versionchanged:: 1.1a2
If the ``greenlet`` has a
``kill`
` method, calls it. This prevents a
If the ``greenlet`` has a
:meth:`kill <Greenlet.kill>
` method, calls it. This prevents a
greenlet from being switched to for the first time after it's been
killed.
killed
but not yet executed
.
"""
if
not
greenlet
.
dead
:
if
hasattr
(
greenlet
,
'kill'
):
...
...
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