Check if tasklet is in scheduler?

Giovanni Bajo giovannibajo at libero.it
Mon Oct 6 17:29:02 CEST 2003


On Monday, October 06, 2003 4:24 PM [GMT+1=CET],
Christian Tismer <tismer at tismer.com> wrote:

>> Moreover, I would expect a "t.scheduled" to be true even if
>> the tasklet is blocked (which means that after the channel releases
>> its lock, the tasklet will continue execution). Actually, I think
>> t.paused is a little too "complex" from a semantic standpoint. I
>> would rather have low-level computed attributes for very easy
>> boolean properties (like t.blocked, t.scheduled, t.alive) and then
>> do my own more hi-level attributes like "ispaused = (not
>> t.scheduled) and (not t.blocked) and t.alive" (straightforward from
>> the docstring).
>
> Since blocked is as it should be, there is just scheduled left.
>
> t.scheduled == (t.next != None)
>
> Is that correct?

Yes, this is exactly what I need. I think it's worth adding this attribute
to allow people not to rely on t.next (which is strictly
implementation-dependent).

> Since I *might* allow "dead" tasklets to be still in the
> chain in some future (just carrying data), it might make
> sense to define
>
> t.scheduled == (t.next != None) and t.alive
> but I don't care too much. (Today this is identical since
> nothing dead can be in a chain).

Yes, no difference for me as well. As I said, I prefer to have many simple
attributes completely orthogonal with each other, so I'd rather not
t.scheduled depend on t.alive in any way.

Giovanni Bajo





More information about the Stackless mailing list