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
620691c7
Commit
620691c7
authored
Jul 29, 2011
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hub.join(): add timeout argument
parent
fac41703
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
8 deletions
+15
-8
gevent/hub.py
gevent/hub.py
+15
-8
No files found.
gevent/hub.py
View file @
620691c7
...
...
@@ -320,21 +320,28 @@ class Hub(greenlet):
# to return an unexpected value
raise
LoopExit
def
join
(
self
):
def
join
(
self
,
timeout
=
None
):
"""Wait for the event loop to finish. Exits only when there are
no more spawned greenlets, started servers, active timeouts or watchers.
"""
assert
getcurrent
()
is
self
.
parent
,
"only possible from MAIN greenlet"
if
not
self
or
self
.
dead
:
if
_threadlocal
.
__dict__
.
get
(
'hub'
)
is
self
:
_threadlocal
.
__dict__
.
pop
(
'hub'
)
self
.
run
=
None
else
:
if
self
.
dead
:
return
if
timeout
is
not
None
:
timeout
=
self
.
loop
.
timer
(
timeout
)
timeout
.
start
(
getcurrent
().
switch
)
timeout
.
loop
.
unref
()
try
:
try
:
self
.
switch
()
except
LoopExit
:
pass
self
.
loop
.
error_handler
=
None
# break the ref cycle
return
True
finally
:
if
timeout
is
not
None
and
timeout
.
active
:
timeout
.
loop
.
ref
()
timeout
.
stop
()
def
_get_resolver
(
self
):
if
self
.
_resolver
is
None
:
...
...
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