diff options
author | YAMAMOTO Takashi <yamamoto@valinux.co.jp> | 2013-05-08 15:24:43 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2013-05-10 00:36:31 +0900 |
commit | 47bc96ef98bc0f4e0fc6d1b521aff8120aeba5d1 (patch) | |
tree | d3ed39f07d2779ce8bda281cef548f3cb96f5878 | |
parent | 6955c13e4e08351638a150526224061f2d79040d (diff) |
hub: handle GreenletExit internally
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | ryu/lib/hub.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/ryu/lib/hub.py b/ryu/lib/hub.py index 49f3a9c5..4ed0a144 100644 --- a/ryu/lib/hub.py +++ b/ryu/lib/hub.py @@ -33,6 +33,7 @@ if HUB_TYPE == 'eventlet': import eventlet.queue import eventlet.timeout import eventlet.wsgi + import greenlet import ssl import traceback @@ -46,6 +47,8 @@ if HUB_TYPE == 'eventlet': # by not propergating an exception to the joiner. try: func(*args, **kwargs) + except greenlet.GreenletExit: + pass except: # log uncaught exception. # note: this is an intentional divergence from gevent @@ -60,7 +63,12 @@ if HUB_TYPE == 'eventlet': def joinall(threads): for t in threads: - t.wait() + # this try-except is necessary when killing an inactive + # greenthread + try: + t.wait() + except greenlet.GreenletExit: + pass Queue = eventlet.queue.Queue QueueEmpty = eventlet.queue.Empty |