Simon Wittber wrote: > I've just uploaded a new version to the cheeseshop, which implements > UDP 'channels'. I've been playing with your code for a couple of days. It's really cool, but I think some demonstration code would be helpful. For instance, I think the attached code might demonstrate some of the pertinent features of nanothreads.py. Ethan
import nanothreads
def sleepgen(n):
for i in xrange(5):
print 'I like to sleep for',n,'seconds'
yield nanothreads.SLEEP(n)
nanothreads.install(sleepgen(1))
nanothreads.install(sleepgen(5))
def killpool():
nanothreads.shutdown()
nanothreads.defer_for(25, killpool)
nanothreads.loop()
Attachment:
signature.asc
Description: OpenPGP digital signature