[Stackless] Newbie question
richard.m.tew at gmail.com
Thu Sep 4 15:59:43 CEST 2008
On Wed, Sep 3, 2008 at 4:08 PM, Jay Shaffstall <jshaffstall at gmail.com> wrote:
> I'd thought that each tasklet would run once, round robin style, with
> all others getting run once before the first ran again. A tasklet
> that tried to receive on an empty channel would block, and when
> another tasklet sent to that channel the first would unblock and go
> back into the round robin queue.
> Am I misunderstanding how stackless works? Because what I think I'm
> seeing is that the receiving tasklet runs immediately. I don't have
> any call to stackless.run, but as soon as I call send on a channel,
> the receiving tasklet runs, rather than having the send queue up until
> the tasklet is next up to run.
This behaviour is defined by the 'preference' attribute of the channel:
Help on getset descriptor __builtin__.channel.preference:
-1 prefer receiver (default), 1 prefer sender, 0 don't
prefer anything. See also schedule_all
You probably want to set it to 1 for your channel.
More information about the Stackless