Created
January 7, 2013 22:13
-
-
Save colwilson/4479022 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env stackless | |
import stackless | |
def sendKidsToShops(): | |
kids = 3 | |
ch.send(kids) | |
print kids, "kids sent to the store" | |
def buySweeties(): | |
n = ch.receive() | |
while n: | |
print "kid #", n, "is spending your money on candy." | |
n -= 1 | |
#stackless.schedule() | |
ch = stackless.channel() | |
stackless.tasklet(sendKidsToShops)() | |
stackless.tasklet(buySweeties)() | |
stackless.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment