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
980853da
Commit
980853da
authored
Jun 18, 2012
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make reinit() and fork() only call loop.reinit() if there's a hub
parent
65396622
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
+9
-6
gevent/__init__.py
gevent/__init__.py
+1
-5
gevent/hub.py
gevent/hub.py
+8
-1
No files found.
gevent/__init__.py
View file @
980853da
...
...
@@ -41,16 +41,12 @@ from gevent.greenlet import Greenlet, joinall, killall
spawn
=
Greenlet
.
spawn
spawn_later
=
Greenlet
.
spawn_later
from
gevent.timeout
import
Timeout
,
with_timeout
from
gevent.hub
import
getcurrent
,
GreenletExit
,
spawn_raw
,
sleep
,
idle
,
kill
,
signal
from
gevent.hub
import
getcurrent
,
GreenletExit
,
spawn_raw
,
sleep
,
idle
,
kill
,
signal
,
reinit
try
:
from
gevent.hub
import
fork
except
ImportError
:
__all__
.
remove
(
'fork'
)
def
reinit
():
return
get_hub
().
loop
.
reinit
()
def
run
(
timeout
=
None
,
event
=
None
):
return
get_hub
().
join
(
timeout
=
timeout
,
event
=
event
)
gevent/hub.py
View file @
980853da
...
...
@@ -18,6 +18,7 @@ __all__ = ['getcurrent',
'sleep'
,
'kill'
,
'signal'
,
'reinit'
,
'fork'
,
'get_hub'
,
'Hub'
,
...
...
@@ -176,12 +177,18 @@ class signal(object):
self
.
hub
.
handle_error
(
None
,
*
sys
.
exc_info
())
def
reinit
():
hub
=
_get_hub
()
if
hub
is
not
None
:
hub
.
loop
.
reinit
()
if
_original_fork
is
not
None
:
def
fork
():
result
=
_original_fork
()
if
not
result
:
get_hub
().
loop
.
reinit
()
reinit
()
return
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