[Stackless] Explicit yield/break to Preemptive Stackless Loop

Jeff Senn senn at maya.com
Thu Nov 9 14:31:41 CET 2006

On Nov 9, 2006, at 6:50 AM, Richard Tew wrote:

> On 11/4/06, Brian Hardie <bhardie at cs.usfca.edu> wrote:
>> schedule_task_block(PyTaskletObject *prev, int stackless)
>> {
>>     ...
>>     if (check_for_deadlock()) {
>>        /*revive real main if floating */
>>        if (ts == slp_initial_tstate && ts->st.main->next == NULL) {
>>           /* emulate old revive main behavior:
>>            * passing a value only if it is an exception
>> ...
>> I think the expression 'ts == slp_initial_tstate' is checking to  
>> see if
>> we are running within the main thread.  If so, it recovers the main
>> tasklet.  My tasklets are not run by the main thread; perhaps this  
>> has
>> been a problem.

D'oh. I didn't actually answer your question.

I'm a little bit guessing, but to me it looks like
we should remove that 'ts == slp_initial_tstate'
since (I think?) we want that deadlock behavior in all threads...
(and each thread's "main tasklet" can sort out any inter-thread

We should probably review the other places a comparison
with slp_initial_tstate is made...

The one in slp_schedule_task (and a couple in taskletobject.c)
that bracket calls to slp_ensure_linkage... I'm not completely
sure about.  Perhaps it is sufficient to always just call
slp_ensure_linkage.  Christian?

The one in tasklet_end looks ok.


Stackless mailing list
Stackless at stackless.com

More information about the Stackless mailing list