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
c9db4115
Commit
c9db4115
authored
Jun 25, 2015
by
Jason Madden
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/wiggin15/gevent
into pr482
parents
10045fd3
49492966
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
16 deletions
+10
-16
gevent/greenlet.py
gevent/greenlet.py
+1
-5
gevent/hub.py
gevent/hub.py
+9
-11
No files found.
gevent/greenlet.py
View file @
c9db4115
...
...
@@ -412,13 +412,9 @@ def joinall(greenlets, timeout=None, raise_error=False, count=None):
if
not
raise_error
:
wait
(
greenlets
,
timeout
=
timeout
,
count
=
count
)
else
:
for
obj
in
iwait
(
greenlets
,
timeout
=
timeout
):
for
obj
in
iwait
(
greenlets
,
timeout
=
timeout
,
count
=
count
):
if
getattr
(
obj
,
'exception'
,
None
)
is
not
None
:
raise
obj
.
exception
if
count
is
not
None
:
count
-=
1
if
count
<=
0
:
break
def
_killall3
(
greenlets
,
exception
,
waiter
):
...
...
gevent/hub.py
View file @
c9db4115
...
...
@@ -605,19 +605,25 @@ class Waiter(object):
# and unwraps it in wait() thus checking that switch() was indeed called
def
iwait
(
objects
,
timeout
=
None
):
def
iwait
(
objects
,
timeout
=
None
,
count
=
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?)
if
objects
is
None
:
yield
get_hub
().
join
(
timeout
=
timeout
)
return
waiter
=
Waiter
()
switch
=
waiter
.
switch
if
timeout
is
not
None
:
timer
=
get_hub
().
loop
.
timer
(
timeout
,
priority
=-
1
)
timer
.
start
(
waiter
.
switch
,
_NONE
)
try
:
count
=
len
(
objects
)
if
count
is
None
:
count
=
len
(
objects
)
else
:
count
=
min
(
count
,
len
(
objects
))
for
obj
in
objects
:
obj
.
rawlink
(
switch
)
for
_
in
xrange
(
count
):
...
...
@@ -666,15 +672,7 @@ def wait(objects=None, timeout=None, count=None):
"""
if
objects
is
None
:
return
get_hub
().
join
(
timeout
=
timeout
)
result
=
[]
if
count
is
None
:
return
list
(
iwait
(
objects
,
timeout
))
for
obj
in
iwait
(
objects
=
objects
,
timeout
=
timeout
):
result
.
append
(
obj
)
count
-=
1
if
count
<=
0
:
break
return
result
return
list
(
iwait
(
objects
,
timeout
,
count
))
class
linkproxy
(
object
):
...
...
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