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
324523ec
Commit
324523ec
authored
Jul 08, 2015
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
doc update. fixes #394. [skip ci]
parent
d7b8b4e8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
8 deletions
+24
-8
gevent/greenlet.py
gevent/greenlet.py
+16
-4
gevent/hub.py
gevent/hub.py
+8
-4
No files found.
gevent/greenlet.py
View file @
324523ec
...
...
@@ -205,7 +205,7 @@ class Greenlet(greenlet):
"""Immediatelly switch into the greenlet and raise an exception in it.
Should only be called from the HUB, otherwise the current greenlet is left unscheduled forever.
To raise an exception in a safe
ly
manner from any greenlet, use :meth:`kill`.
To raise an exception in a safe manner from any greenlet, use :meth:`kill`.
If a greenlet was started but never switched to yet, then also
a) cancel the event that will start it
...
...
@@ -266,14 +266,26 @@ 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 ``True`` (the default), wait until the greenlet dies or the optional timeout expires.
If block is ``False``, the current greenlet is not unscheduled.
The function always returns ``None`` and never raises an error.
`Changed in version 0.13.0:` *block* is now ``True`` by default.
.. 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 an 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)``.
See also :func:`gevent.kill`.
.. versionchanged:: 0.13.0
*block* is now ``True`` by default.
"""
# XXX this function should not switch out if greenlet is not started but it does
# XXX fix it (will have to override 'dead' property of greenlet.greenlet)
...
...
gevent/hub.py
View file @
324523ec
...
...
@@ -98,11 +98,15 @@ def idle(priority=0):
def
kill
(
greenlet
,
exception
=
GreenletExit
):
"""Kill greenlet asynchronously. The current greenlet is not unscheduled.
"""
Kill greenlet asynchronously. The current greenlet is not unscheduled.
.. note::
Note, that :meth:`gevent.Greenlet.kill` method does the same and more. However,
MAIN greenlet - the one that exists initially - does not have ``kill()`` method
so you have to use this function.
The method :meth:`gevent.Greenlet.kill` method does the same and
more (and the same caveats listed there apply here). However, the MAIN
greenlet - the one that exists initially - does not have a
``kill()`` method so you have to use this function.
"""
if
not
greenlet
.
dead
:
get_hub
().
loop
.
run_callback
(
greenlet
.
throw
,
exception
)
...
...
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