[Stackless] uthread.py

Richard Tew richard.m.tew at gmail.com
Tue Mar 20 12:57:41 CET 2007


On 3/20/07, Marcus <shutterbug at dwx.com> wrote:
> Could one of you explain what uthread.py would be used for? I've almost
> got the hang of Twisted with Stackless thanks to all the examples people
> have posted recently, but I've been curious as to these uthread.py files
> because I hadn't seen them actually used anywhere.

This is an adaptation of the original uthread.py for use inside CCP Games.
We mainly use it to encapsulate all the Stackless functionality we use.

- Wrapping starting of tasklets.  e.g. uthread.new(f)

  We do this primarily so that our custom tasklet creation functions are
used.  But for my own personal use outside of the CCP framework I would
probably use a function like this anyway to catch all unhandled exceptions
which reach their way up to a wrapping function.  Our custom tasklet
creation functions probably do this in addition to a number of other things.

Then theres uthread.pool, uthread.parallel.  I forget when uthread.pool
shoulg be used.  But uthread.parallel is quite handy for having your
function block on the calling of multiple functions in parallel and handing
you back the results.

- Convenience functionality.

  Tasklet based tools like critical sections, semaphores, locks and
so forth.  Quite handy to have.

As it is stripped of all CCP framework dependencies, it is probably a little
rough around the edges and not surprising that no-one appears to be
using them.  But if anyone wants to do some work to upgrade this file
then patches are welcomed.

There is also what is known as "Ásgeir's uthread".  I know nothing about
this other than having added it since it would be unfair to just add CCP's
version.  But perhaps someone else is using it and can describe the
whys and wherefores of it.

Hope this helps in some sense,
Richard.

_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless



More information about the Stackless mailing list