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
abd614aa
Commit
abd614aa
authored
Jul 18, 2009
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
greenlet.py: raise an exception when used in non-main thread
multithreading is not supported by core.pyx yet
parent
7f819b4e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
gevent/greenlet.py
gevent/greenlet.py
+10
-8
No files found.
gevent/greenlet.py
View file @
abd614aa
...
...
@@ -27,7 +27,10 @@ except ImportError:
getcurrent
=
greenlet
.
getcurrent
GreenletExit
=
greenlet
.
GreenletExit
MAIN
=
greenlet
.
getcurrent
()
_threadlocal
=
None
thread
=
__import__
(
'thread'
)
threadlocal
=
thread
.
_local
_threadlocal
=
threadlocal
()
class
TimeoutError
(
Exception
):
...
...
@@ -168,14 +171,11 @@ def signal(signalnum, handler, *args, **kwargs):
def
get_hub
():
global
_threadlocal
try
:
hub
=
_threadlocal
.
hub
return
_threadlocal
.
hub
except
AttributeError
:
# do not import anything that can be monkey-patched at top level
import
threading
# XXX use _local directly from _thread or from _threadlocal
_threadlocal
=
threading
.
local
()
hub
=
_threadlocal
.
hub
=
Hub
()
return
hub
# do not pretend to support multiple threads because it's not implemented properly by core.pyx
# this may change in the future, although currently I don't have a strong need for this
raise
NotImplementedError
(
'gevent is only usable from a single thread'
)
class
Hub
(
object
):
...
...
@@ -214,6 +214,8 @@ class Hub(object):
raise
DispatchExit
(
'No events registered'
)
raise
DispatchExit
(
'dispatch() exited with code %s'
%
(
result
,
))
_threadlocal
.
hub
=
Hub
()
class
DispatchExit
(
Exception
):
pass
...
...
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