diff options
| author | Ryan Williams <rdw@lindenlab.com> | 2010-02-13 18:58:35 -0800 |
|---|---|---|
| committer | Ryan Williams <rdw@lindenlab.com> | 2010-02-13 18:58:35 -0800 |
| commit | 64ad004e5d74cc691577fd43ba742a8db4ad2bf6 (patch) | |
| tree | 709d03648bb38a8624cc97ba0b487e207420562a /eventlet/greenthread.py | |
| parent | 695159bdb1521f474d6532e9ecadd1dd4b85629d (diff) | |
| download | eventlet-64ad004e5d74cc691577fd43ba742a8db4ad2bf6.tar.gz | |
Moved timer to hubs package, since that's almost all of its usage.
Diffstat (limited to 'eventlet/greenthread.py')
| -rw-r--r-- | eventlet/greenthread.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/eventlet/greenthread.py b/eventlet/greenthread.py index 4b81d8a..bfaa555 100644 --- a/eventlet/greenthread.py +++ b/eventlet/greenthread.py @@ -2,7 +2,7 @@ import sys from eventlet import event from eventlet import hubs -from eventlet import timer +from eventlet.hubs import timer from eventlet.support import greenlets as greenlet __all__ = ['getcurrent', 'sleep', 'spawn', 'spawn_n', 'call_after_global', 'call_after_local', 'GreenThread'] @@ -292,19 +292,18 @@ def kill(g, *throw_args): # on its own; semantically we want it to be as though the main # method never got called def just_raise(*a, **kw): - raise throw_args or greenlet.GreenletExit + if throw_args: + raise throw_args[0], throw_args[1], throw_args[2] + else: + raise greenlet.GreenletExit() + g.run = just_raise if isinstance(g, GreenThread): # it's a GreenThread object, so we want to call its main # method to take advantage of the notification - g.run = just_raise try: g.main(just_raise, (), {}) except: pass - else: - # regular greenlet; just want to replace its run method so - # that whatever it was going to run, doesn't - g.run = just_raise hub.schedule_call_global(0, g.throw, *throw_args) if getcurrent() is not hub.greenlet: sleep(0) |
