On Feb 24, 7:51 pm, "[email protected]" <[email protected]>
wrote:
> Can I just see if I understand these responses?
>
> The cooperative threading sounds interesting, I found fibra, but
> couldn't find examples of tasks/tasklets.

It is very interesting! It is also fast, and versatile.

Here is a contrived example.



import fibra

def some_task(sleep_time):
    print "This task has started, and won't finish for %s seconds." %
sleep_time
    yield sleep_time
    print "This task is now about to finish"

def main():
    print "Main is running."
    yield some_task(1)
    yield some_task(2)
    print "Main is finishing."

schedule = fibra.schedule()
schedule.install(main())
schedule.run()

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to