Commit 5da85b40 authored by Denis Bilenko's avatar Denis Bilenko

use second argument to greenlet constructor instead of settings 'parent' attribute

parent cfca6adc
......@@ -65,26 +65,22 @@ def _switch_helper(function, args, kwargs):
def spawn(function, *args, **kwargs):
if kwargs:
g = Greenlet(_switch_helper)
g.parent = get_hub().greenlet
g = Greenlet(_switch_helper, get_hub().greenlet)
core.active_event(g.switch, function, args, kwargs)
return g
else:
g = Greenlet(function)
g.parent = get_hub().greenlet
g = Greenlet(function, get_hub().greenlet)
core.active_event(g.switch, *args)
return g
def spawn_later(seconds, function, *args, **kwargs):
if kwargs:
g = Greenlet(_switch_helper)
g.parent = get_hub().greenlet
g = Greenlet(_switch_helper, get_hub().greenlet)
core.timer(seconds, g.switch, function, args, kwargs)
return g
else:
g = Greenlet(function)
g.parent = get_hub().greenlet
g = Greenlet(function, get_hub().greenlet)
core.timer(seconds, g.switch, *args)
return g
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment