Processes and Channels, cf. goroutines.

Sean Kelly sean at invisibleduck.org
Tue Feb 4 14:08:40 PST 2014


On Tuesday, 4 February 2014 at 19:19:22 UTC, Dicebot wrote:
> On Tuesday, 4 February 2014 at 18:05:17 UTC, Sean Kelly wrote:
>> Support for green threads in std.concurrency is almost 
>> complete. I should really just do the last bit of work. I 
>> imagine you could try out the idea now though by using the 
>> messaging in vibe.d, since every connection is a fiber.
>
> Can you provide any more details? Right now vibe.d uses own 
> implementation 
> (https://github.com/rejectedsoftware/vibe.d/blob/master/source/vibe/core/concurrency.d) 
> - trying to replace with with updated Phobos one can be a good 
> real-world test for such enhancement.

My motivation was to make std.concurrency work with vibe.d.  And
more generally, to start testing fiber-based concurrency in
general.  The basic idea is to make certain low-level parts of
std.concurrency be pluggable, so the same API can be used on top
of different threading schemes.  You basically just need to
implement this interface:

interface Scheduler {
      void start(void delegate() op); // start the scheduler
      void spawn(void delegate() op); // spawn a new thread
      void yield(); // for send and receive to yield to allow green
threading
      Condition newCondition(Mutex m); // the condition will
notify/wait for new messages
}

I should have a sample implementation working for green threads
shortly.  Then I need to submit a bugzilla ticket and sort out a
pull request.


More information about the Digitalmars-d mailing list