I started to polish up the generated python bindings for iris today. They aren't perfect but starting to come together. Compare to the Vala example to see how it's similar.
from iris import * s, e, c = WSScheduler(), Port(), Port() Arbiter.coordinate( Arbiter.receive(e, lambda msg: doStateChange(msg), scheduler=s), Arbiter.receive(c, lambda msg: doHttpRequest(msg), scheduler=s)) # ...
Steve Bjorg of MindTouch also implemented a Work-Stealing scheduler for .NET in the MindTouch Dream library. I'm pretty sure it runs on Mono too. You can take a look at it here.

Comments (7)
Thanks for the mention. You’re quite correct. The StealingTreadPool is compatible with Mono. While the stealing thread pool is virtually lock free, I’m not sure if that’s a benefit on mono though unless it also has a thread-local heap it can allocate from (still trying to figure that out). The implementation follows generally the outline of .Net 4.0 work stealing scheduler as described here: http://bit.ly/pFEZT
Does it need the thread-local heap for allocation of structures that exist in the queue? Could it be mitigated with a free-list per local-queue?
Also, what happens if a neighbor steals a work-item, would this cause contention on free-ing the element back since it is owned by another thread? (I was worried about this myself, but hasn’t been a large enough % of cpu time to dig deeper).
For future readers, if you want examples of iris, I just ported marina to use Iris instead of GTask.
http://git.dronelabs.com/marina/commit/?id=e643048485268cd045ebc41a7a289889267cf72f
Just so you know, in Python
lambda msg: doStateChange(msg)
returns a function that takes msg and calls doStateChange with it, so you might just as well pass doStateChange as the parameter to recieve, instead of creating a lambda. I guess you just copied and pasted the lamba keyword without knowing what it does. If you want to read more about it, go to http://www.diveintopython.org/power_of_introspection/lambda_functions.html
Hi Bob,
I’m quite aware, it wasn’t practical code by any means. It was simply there so readers could see the parameters in a succinct code snippet.
No, no. What I’m saying is that where you have written
Arbiter.receive(e, lambda msg: doStateChange(msg), scheduler=s)
you could have just written
Arbiter.receive(e, doStateChange, scheduler=s)
so you have actually made the code harder to read. What you’ve written would work but it’s what we call “redundant”. Look up the documentation of the lambda keyword and you’ll see why.
Right. Since doStateChange is a superfluous method, it would be necessary to show “def doStateChange(msg):” in the code snippet for readers to know the method took a single argument. I, honestly, felt that users would rather see fewer lines of code. If that is not the case, I can do that differently in the future.