summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-11-19 03:34:18 +0100
committerVictor Stinner <victor.stinner@gmail.com>2014-11-19 03:34:18 +0100
commitcfb742a904dac3fc1a30b7f36111894e7694da05 (patch)
tree91c9cf048ec3027baf2630689ab951111a0314b6
parent3fedc23ddb527353323a9999f75ecd12a57e3c40 (diff)
downloadaioeventlet-cfb742a904dac3fc1a30b7f36111894e7694da05.tar.gz
adjust policy regarding to threads
-rw-r--r--aiogreen.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/aiogreen.py b/aiogreen.py
index 2d5ec6f..a9e489f 100644
--- a/aiogreen.py
+++ b/aiogreen.py
@@ -40,7 +40,7 @@ class EventLoopPolicy(asyncio.AbstractEventLoopPolicy):
def get_event_loop(self):
if not _is_main_thread():
- raise NotImplementedError("currently aiogreen can only run in the main thread")
+ return None
if self._loop is None:
self._loop = EventLoop()
return self._loop
@@ -49,8 +49,8 @@ class EventLoopPolicy(asyncio.AbstractEventLoopPolicy):
return EventLoop()
def set_event_loop(self, loop):
- if self._loop is not None:
- raise NotImplementedError("cannot run two event loops in the same thread")
+ if not _is_main_thread():
+ raise NotImplementedError("aiogreen can only run in the main thread")
self._loop = loop