[Stackless] stacklessocket with threads, and stacklessfile

Michael Sparks ms at cerenity.org
Thu Aug 9 02:33:07 CEST 2007


On Thursday 09 August 2007 00:26, Tim Kientzle wrote:
> Our proposal: run the select() loop in a separate
> thread so that the select() doesn't block all other
> tasklets.

In Kamaelia we use generators in a similar manner to stackless's tasklets (not 
quite the same but close), and we put select into a separate thread which 
works very nicely. However, we keep the timeout in select small because we 
currently add sockets to the select sets by sending a message to the thread 
via a Queue.Queue (which doesn't wake select of course). 

We could add in a control file descriptor to wake it, but in practice a tiny 
timeout frees up the CPU sufficiently to make adding in a control file 
descriptor to wake the select unnecessary for us at the moment.

Code for our scheduler & selector component:

http://kamaelia.svn.sourceforge.net/viewvc/kamaelia/trunk/Code/Python/Axon/Axon/Scheduler.py?view=markup
http://kamaelia.svn.sourceforge.net/viewvc/kamaelia/trunk/Code/Python/Kamaelia/Kamaelia/Internet/Selector.py?view=markup

(translate boxes to channels and component to tasklet)


Michael.

_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://stackless.com/cgi-bin/mailman/listinfo/stackless



More information about the Stackless mailing list