From 47bc96ef98bc0f4e0fc6d1b521aff8120aeba5d1 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Wed, 8 May 2013 15:24:43 +0900 Subject: hub: handle GreenletExit internally Signed-off-by: YAMAMOTO Takashi Signed-off-by: FUJITA Tomonori --- ryu/lib/hub.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3