[Stackless] Stackless uthread-ccp module usage

Carlos Eduardo de Paula cedepaula at yahoo.com.br
Fri Feb 23 19:04:35 CET 2007

Hello guys, 

I started to use stackless again (was very busy on my work) and now after all discussion on stackless mailling list and docs i´ve been reading I understand stackless better.

Looking thru the uthread-ccp you provided on sandbox, i saw made a small example and found out something wrong.

I made:
from uthread import *

def doStuff(mult=1):
    st = time.time()
    c = 0
    for i in xrange(int(100000*mult)):
        c = c + 1
    print 100000*mult, " operations took: " , time.time() - st , " seconds."





but the app returns not executing my tasklets.

Doing the same with the 'stackless.schedule()' and 'stackless.run()' way my app worked printing something like:

100000  operations took:  1.00099992752  seconds.
200000  operations took:  1.82899999619  seconds.
300000  operations took:  2.48600006104  seconds.
400000  operations took:  3.01699995995  seconds.
500000  operations took:  3.36100006104  seconds.

I found that the problem is around the Run() function in uthread module, it checks for yieldChannel.balance or len(sleepingTasklets) but none have tasklets on yet on startup, putting some debug into Run method, i checked that only after 1 loop the yieldChannel gets to -5 (quantity of tasklets I have).

Am I doing something wrong or any correction should be made on Run method?

One more thing... I didnt get the:

        t = stackless.run(10000000)
        if t is not None:
            # Need better standard handling of this case.
            # Could StackTrace I guess?
            raise RuntimeError("Runaway tasklet", t.id)

How do this watchdog works, what is the 100000000 in the run? Seconds? What do it waits till an exception is raised?

Ps.Sorry if i´m a little dumb on this but its something i didnt got yet.

Best regards and thanks for all,


No need to miss a message. Get email on-the-go 
with Yahoo! Mail for Mobile. Get started.

Stackless mailing list
Stackless at stackless.com

More information about the Stackless mailing list