[Stackless] Threads and Tasklets
andrewfr_ice at yahoo.com
Mon Oct 24 18:00:48 CEST 2005
This is how I understand it...
>While I may be wrong, I doubt you can have a separate
>instance of the stackless module running in each
>thread as I believe it implements a singleton of the
>scheduler. You would have to have either one thread
>that does stackless things and the rest as worker
>type threads or a separate interpreter for each
>stackless instance I expect.
I am interested in scenario one:
1) Thread One running stackless
2) Thread Two running I/O stuff
The two threads communicate asynchronous - i.e., a
queue. The stackless thread is reactive - it runs
when there is input.
> the impression that tasklets will block on system
> I/O. If I wish to do networking, can I use tasklets
> to communicate with heavier weight threads, with
>If you want a tasklet to block while communicating
>with something and the rest of the tasklets in the
>scheduler to carry on being scheduled, I believe you
>have to write code yourself
I suspect you are right. Luckily Asgir's code
shows how one can write a scheduler.
>When it comes to the actual communication with
>threads all I can do is hand-wave.
That is okay. I may have to sit down and
try this myself. I was hoping to save time
by seeing if anyone knows the answer offhand.
>Here is a simple Python based MUD server that does
>non-blocking networking. It uses channels to stall a
>specific tasklet for incoming data:
Thanks, I will look at the code.
>I hope this helps, sorry if I cannot be any help WRT
>threads, but I haven't touched them since I started
>Python scripting at CCP.
No problem Richard. You have been helpful. I need
to experiment. And I will post what I learn. I
think we all go further by sharing information so
others don't re-invent the wheel.
Start your day with Yahoo! - Make it your home page!
Stackless mailing list
Stackless at stackless.com
More information about the Stackless