[Stackless] An idea for making Stackless more naturally usable
richard.m.tew at gmail.com
Sun Sep 10 12:27:54 CEST 2006
On 9/10/06, Richard Tew <richard.m.tew at gmail.com> wrote:
> On 9/9/06, Andrew Dalke <dalke at dalkescientific.com> wrote:
> > Hence asyncore also needs its own per-thread scheduler via it's own
> > threading.local()
> This example was just written to show that the scheduler for each
> thread is independent. If you take into account that channels
> should be able to send and receive (although I have never used
> this functionality) between tasklets on different threads, then
> it should be possible to write a 'ManageSleepingTasklets' which
> runs on one thread and works for them all.
> But I have no example to prove this, and as I say I have not
> used threading much if at all, so I guess it would be best to
> write one to prove it.
I have written up an example showing interthread channel behaviour:
I was hoping that the 'preference' attribute would allow tasklets
woken up by a shared sleep function to be scheduled in the
future rather than immediately (using the prefer sender setting),
but it appears from the source code that when the target tasklet
is from another thread, the thread is switched to and the target
tasklet is scheduled immediately, which seems a little heavy
to be actually used in a shared scheduler.
Perhaps one per thread is the best idea.
Stackless mailing list
Stackless at stackless.com
More information about the Stackless