<div dir="ltr"><div><div>I've made the scheduler a bit more inteligent and the channel implementation is now backed by a lock free queue.<br><a href="https://github.com/rjmcguire/goport/blob/tip/wrapper2.d">https://github.com/rjmcguire/goport/blob/tip/wrapper2.d</a> for a example using libev<br>
<br><a href="https://github.com/rjmcguire/goport/blob/tip/goroutine.d">https://github.com/rjmcguire/goport/blob/tip/goroutine.d</a> for the "go" routines<br><br><a href="https://github.com/rjmcguire/goport/blob/tip/channel.d">https://github.com/rjmcguire/goport/blob/tip/channel.d</a> channel implementation, the channel still has a read lock because I didn't like looping wasting cpu cycles/battery, I may change this to use the same loop as the select(...) expression with a timeout that backs off.<br>
<br><a href="https://github.com/rjmcguire/goport/blob/tip/concurrentlinkedqueue.d">https://github.com/rjmcguire/goport/blob/tip/concurrentlinkedqueue.d</a> queue implementation<br><br><br></div>there is a problem with the file EV handler in that it can get spurios READ events and I can't seem to set it to non-blocking.<br>
<br></div>The select(...) implementation and usage is quite interesting because it works very much like Go's select statement.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Aug 26, 2013 at 1:28 AM, Rory McGuire <span dir="ltr"><<a href="mailto:rjmcguire@gmail.com" target="_blank">rjmcguire@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>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.<br>
<br></div>BTW: gist is at: <a href="https://gist.github.com/rjmcguire/6336931" target="_blank">https://gist.github.com/rjmcguire/6336931</a><br>
<br></div>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.<br>

<div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Aug 26, 2013 at 1:21 AM, Timon Gehr <span dir="ltr"><<a href="mailto:timon.gehr@gmx.ch" target="_blank">timon.gehr@gmx.ch</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>On 08/26/2013 12:55 AM, Rory McGuire wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
shared chan!Fiber scheduler; // channel contains Fibers waiting for<br>
their time slice<br>
static this () {<br>
     if (scheduler is null) {<br>
</blockquote>
<br>
<br></div>
You want 'shared static this' instead to avoid a race condition.<br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>