Skip to content

Instantly share code, notes, and snippets.

@colwilson
Created January 7, 2013 22:13
Show Gist options
  • Save colwilson/4479022 to your computer and use it in GitHub Desktop.
Save colwilson/4479022 to your computer and use it in GitHub Desktop.
#!/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