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
ac914c56
Commit
ac914c56
authored
Aug 18, 2009
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Greenlet: rename link's argument 'callback' to 'receiver'
parent
d09b0c7c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
20 deletions
+20
-20
gevent/greenlet.py
gevent/greenlet.py
+20
-20
No files found.
gevent/greenlet.py
View file @
ac914c56
...
...
@@ -353,39 +353,39 @@ class Greenlet(greenlet):
if
self
.
ready
()
and
self
.
_notifier
is
None
:
self
.
_notifier
=
core
.
active_event
(
self
.
_notify_links
)
def
link
(
self
,
callback
=
None
,
GreenletLink
=
GreenletLink
,
SpawnedLink
=
SpawnedLink
):
def
link
(
self
,
receiver
=
None
,
GreenletLink
=
GreenletLink
,
SpawnedLink
=
SpawnedLink
):
"""Link greenlet's completion to callable or another greenlet.
callback
is None means link to the current greenlet.
Always asynchronous, unless
callback
is a current greenlet and the result is ready.
receiver
is None means link to the current greenlet.
Always asynchronous, unless
receiver
is a current greenlet and the result is ready.
"""
current
=
getcurrent
()
if
callback
is
None
or
callback
is
current
:
callback
=
GreenletLink
(
current
)
if
receiver
is
None
or
receiver
is
current
:
receiver
=
GreenletLink
(
current
)
if
self
.
ready
():
# special case : linking to current greenlet when link is ready
# raise LinkedExited immediatelly
callback
(
self
)
receiver
(
self
)
return
elif
not
callable
(
callback
):
if
isinstance
(
callback
,
greenlet
):
callback
=
GreenletLink
(
callback
)
elif
not
callable
(
receiver
):
if
isinstance
(
receiver
,
greenlet
):
receiver
=
GreenletLink
(
receiver
)
else
:
raise
TypeError
(
'Expected callable or greenlet: %r'
%
(
callback
,
))
raise
TypeError
(
'Expected callable or greenlet: %r'
%
(
receiver
,
))
else
:
callback
=
SpawnedLink
(
callback
)
self
.
rawlink
(
callback
)
receiver
=
SpawnedLink
(
receiver
)
self
.
rawlink
(
receiver
)
def
unlink
(
self
,
callback
=
None
):
if
callback
is
None
:
callback
=
getcurrent
()
self
.
_links
.
discard
(
callback
)
def
unlink
(
self
,
receiver
=
None
):
if
receiver
is
None
:
receiver
=
getcurrent
()
self
.
_links
.
discard
(
receiver
)
def
link_value
(
self
,
callback
=
None
,
GreenletLink
=
SuccessGreenletLink
,
SpawnedLink
=
SuccessSpawnedLink
):
self
.
link
(
callback
=
callback
,
GreenletLink
=
GreenletLink
,
SpawnedLink
=
SpawnedLink
)
def
link_value
(
self
,
receiver
=
None
,
GreenletLink
=
SuccessGreenletLink
,
SpawnedLink
=
SuccessSpawnedLink
):
self
.
link
(
receiver
=
receiver
,
GreenletLink
=
GreenletLink
,
SpawnedLink
=
SpawnedLink
)
def
link_exception
(
self
,
callback
=
None
,
GreenletLink
=
FailureGreenletLink
,
SpawnedLink
=
FailureSpawnedLink
):
self
.
link
(
callback
=
callback
,
GreenletLink
=
GreenletLink
,
SpawnedLink
=
SpawnedLink
)
def
link_exception
(
self
,
receiver
=
None
,
GreenletLink
=
FailureGreenletLink
,
SpawnedLink
=
FailureSpawnedLink
):
self
.
link
(
receiver
=
receiver
,
GreenletLink
=
GreenletLink
,
SpawnedLink
=
SpawnedLink
)
def
_notify_links
(
self
):
try
:
...
...
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