[Stackless] Updated version of CCP's uthread module

Richard Tew richard.m.tew at gmail.com
Wed Aug 23 11:48:54 CEST 2006


There was a question from Will Ware on the wiki about locking,
and it reminded me that we have a modified version of uthread
with a lot of simple functions that we use alot throughout the
EVE codebase.

Since there was already an old version of uthread in the
SVN repository, which appeared to have come from CCP, I have
gotten permission from my boss Halldór to update it with a
modified version of the version we currently use.

It is checked in here:


The modifications are just to replace custom framework calls
that it made to various bits and pieces in the EVE framework.
These are mostly removed, but there are still some changes
still to be made:

 - Needs a version of BeNice added.
 - Needs a version of Sleep added.
 - Needs references to local storage to be removed or
   replaced (I don't know what these are for, and have to
   talk to a coworker).

So, it is in, but probably about as usable as the very old
version it is replacing for now.  I have versions of BeNice
and Sleep to put in, but they are at home, so this will have
to wait.

Here are some modified snippets showing some use of the
functions I use in my day to day work:

    uthread.Lock(self, "GetInstance", itemID)
        uthread.UnLock(self, "GetInstance", itemID)

    uthread.ReentrantLock(self, "GetInstance", itemID)
        uthread.UnLock(self, "GetInstance", itemID)

    # Build up a list of concurrent tasklets to execute.
    # These will all block on the DB level in parallel.
    tmp = []
    skillAndLevelGiveList = [
       (miningSkillType, 5),
       (lasersSkillType, 3),
    for skillID, skillLevel in skillAndLevelGiveList:
            (charID, skillID, skillLevel)))
    # Run them all and return the collected results.
    miningSkillID, lasersSkillID = uthread.parallel(tmp)

    # Launch a named tasklet from the tasklet pool.  We
    # clock time to the name which explicitly doubles as
    # a hierarchical context for time to be clocked to
    # but this is not in the module.
        ManagePirates, groupID)

The examples above are mangled versions some form of use
they are put to in our codebase.


Stackless mailing list
Stackless at stackless.com

More information about the Stackless mailing list