Awesome thanks, thought what I did there was dodgy. It was really weird when this() started multiple schedulers at least now I see the obvious reason.

BTW: gist is at: https://gist.github.com/rjmcguire/6336931

Could someone point me at the correct linked list to use inside the channel. I'd prefer to use a range container of some kind if it exists in the std lib. I tried SList and had a bad experience hence the custom implementation.



On Mon, Aug 26, 2013 at 1:21 AM, Timon Gehr <timon.gehr@gmx.ch> wrote:
On 08/26/2013 12:55 AM, Rory McGuire wrote:

shared chan!Fiber scheduler; // channel contains Fibers waiting for
their time slice
static this () {
     if (scheduler is null) {


You want 'shared static this' instead to avoid a race condition.