Last active
December 24, 2015 12:39
-
-
Save brianray/6799197 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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