[Stackless] Channels between threads

Andrew Francis andrewfr_ice at yahoo.com
Sun Jan 20 18:06:08 CET 2008

Hi Simon:

> I understand that channel.send will block until a
> receive is made. 
> However, this receive is being made in the
> requesting thread and the 
> results are successfully received!
> So why does this code never reach the line "Ready
> for new work"?
> Before the ch.send, the balance on the channel is 0.
> In the receiving code, the balance on the channel
> after the receive is 
> 1, even tho the data IS received.
> Can anyone imagine why this might be? or have I
> misunderstood?

Without seeing the rest of the code and output, I
would recommend you look at what *all* the tasklets in
the system are doing. Are  all tasklets blocked except
for perhaps a tick() that prevents the Stackless
Scheduler from thinking it is deadlocked (when in
reality it is)?

Remember that when a tasklet performs a send or a
receive, it is placed at the end of the scheduled list
and other scheduled tasklets will execute. The
Stackless scheduler's behavior in conjunction with a
channel being inadvertently shared could explain why
you think the balance is wrong (think of a race
condition occuring). For kicks, do a __reduce__() on
the channel and see what tasklets are attached.


Never miss a thing.  Make Yahoo your home page. 

More information about the Stackless mailing list