[Stackless] stackless inter-thread queues

Paul Sijben sijben at eemvalley.com
Tue Mar 17 09:59:09 CET 2009

Hi Richard,

Being faced with the situation that I need queue-like behaviour, so one
tasklet needs to be waiting on the channel and in some cases this is the
only tasklet. If it were always the only tasklet in that thread then I
could simply use Queue.Queue.

Is there a way I can make a dummy tasklet to be scheduled when there is
noting else to do? But one that does not load the CPU?


Richard Tew wrote:
> On Mon, Mar 16, 2009 at 10:16 AM, Paul Sijben <sijben at eemvalley.com> wrote:
>> StopIteration('the main tasklet is receiving without a sender available.',)
>> Initially I had simply caught it, I now uncommented that out and now
>> commented that except out and found it does not like to be the only tasklet
>> AND waiting on a channel. But since it is running in the second thread it
>> will be revived anyway.
>> Is there a way to prevent this exception from happening when there are
>> multiple threads?
> Hi Paul,
> You definitely need to prevent this exception from happening.  Each
> time it occurs, it means the main tasklet is being awoken from the
> channel it is blocked on because there is nothing else to do.  Given
> that it was blocked on that channel for a reason.. well, this may not
> be the best thing for correct operation of an application.
> It happens when:
> 1. The main tasklet is blocked on a channel.
> 2. There is one and only one tasklet in the scheduler and it is now exiting.
> The scheduler needs to switch to another tasklet and there are none.
> Whatever other tasklets on that thread exist, have to be blocked out
> of the scheduler, whether on channels or whatever.  So, whether it
> likes it or not, the main tasklet gets awakened.
> So what to do?  The short answer is avoid this situation.  The long
> answer is that perhaps this is a part of Stackless which needs to be
> looked at to bring it into line with the recent "threadblock" changes.
>  I'd need to discuss that with Kristjan Valur or Christian.
> Cheers,
> Richard.

Paul Sijben                    	        tel: +31334566488
Eemvalley Technology     		fax: +31334557523
the Netherlands                   	http://eemvalley.com    

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20090317/6384b9ca/attachment.htm>

More information about the Stackless mailing list