Skip to content

Instantly share code, notes, and snippets.

@brianray
Last active December 24, 2015 12:39
Show Gist options
  • Save brianray/6799197 to your computer and use it in GitHub Desktop.
Save brianray/6799197 to your computer and use it in GitHub Desktop.
from gevent import spawn, sleep
def g1():
print "g1 enter"
spawn(g2)
print "g1 exit"
def g2():
while True:
print "g2 still there"
sleep(0.5)
# does not work since the return of spawn() falls off stack
def run():
spawn(g1)
run()
sleep(10.0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment