[Stackless] Stackless based replacement
andrewfr_ice at yahoo.com
Tue Oct 14 14:59:39 CEST 2008
> Message: 1
> Date: Mon, 13 Oct 2008 07:43:53 -0700
> From: "Larry Dickson"
> <ldickson at cuttedge.com>
> To: "Arnar Birgisson" <arnarbi at gmail.com>
> Cc: stackless at stackless.com
> <1c748a490810130743o4ce691f6s8653df6baed3965b at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
> No joy as yet. The Stackless channels do set up the second
> queue in my note already,
>> Surely not a syntax thing, Stackless currently
>> does not add any new syntax to Python. I imagine something like
>> val = stackless.receive_first([chan1, chan2,....])
> >> Look in the archives for discussion of the syntax.
BPEL (what I work on) has a construct called 'Pick.' I believe a simple way of implementing the aforementioned is to build a synchronizer/semaphore based on a single channel and a counter. The waiting tasklet blocks on the channel. Other tasklets increment (or decrement) a counter. When the counter reaches the desired value, it wakes up the waiting tasklet (with a channel.send()). It is up to the implementer to decide what happens after the synchronizer is 'triggered' or 'signalled' state.
More information about the Stackless