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
c2049f8b
Commit
c2049f8b
authored
Nov 26, 2013
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add docstrings for wait()/iwait()
parent
1c5a07d4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
gevent/hub.py
gevent/hub.py
+29
-0
No files found.
gevent/hub.py
View file @
c2049f8b
...
@@ -580,6 +580,10 @@ class Waiter(object):
...
@@ -580,6 +580,10 @@ class Waiter(object):
def
iwait
(
objects
,
timeout
=
None
):
def
iwait
(
objects
,
timeout
=
None
):
"""Yield objects as they are ready, until all are ready or timeout expired.
*objects* must be iterable yielding instance implementing wait protocol (rawlink() and unlink()).
"""
# QQQ would be nice to support iterable here that can be generated slowly (why?)
# QQQ would be nice to support iterable here that can be generated slowly (why?)
waiter
=
Waiter
()
waiter
=
Waiter
()
switch
=
waiter
.
switch
switch
=
waiter
.
switch
...
@@ -609,6 +613,31 @@ def iwait(objects, timeout=None):
...
@@ -609,6 +613,31 @@ def iwait(objects, timeout=None):
def
wait
(
objects
=
None
,
timeout
=
None
,
count
=
None
):
def
wait
(
objects
=
None
,
timeout
=
None
,
count
=
None
):
"""Wait for *objects* to become ready or for event loop to finish.
If *objects* is provided, it should be an iterable containg objects implementing wait protocol (rawlink() and
unlink() methods):
- :class:`gevent.Greenlet` instance
- :class:`gevent.event.Event` instance
- :class:`gevent.lock.Semaphore` instance
- :class:`gevent.subprocess.Popen` instance
If *objects* is ``None`` (the default), ``wait()`` blocks until all event loops has nothing to do:
- all greenlets have finished
- all servers were stopped
- all event loop watchers were stopped.
If *count* is ``None`` (the default), wait for all of *object* to become ready.
If *count* is a number, wait for *count* object to become ready. (For example, if count is ``1`` then the
function exits when any object in the list is ready).
If *timeout* is provided, it specifies the maximum number of seconds ``wait()`` will block.
Returns the list of ready objects, in the order in which they were ready.
"""
if
objects
is
None
:
if
objects
is
None
:
return
get_hub
().
join
(
timeout
=
timeout
)
return
get_hub
().
join
(
timeout
=
timeout
)
result
=
[]
result
=
[]
...
...
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