RejectedSoftware Forums

Sign up

FYI: Sean Kelly working on fiber enabled std.concurrency

http://forum.dlang.org/post/fhaympiypfkwvztzvagc@forum.dlang.org

Says his motivation is to update Phobos std.concurrency to become compatible with vibe.d

Sounds promising!

Re: FYI: Sean Kelly working on fiber enabled std.concurrency

On Tue, 04 Feb 2014 22:23:31 GMT, Dicebot wrote:

http://forum.dlang.org/post/fhaympiypfkwvztzvagc@forum.dlang.org

Says his motivation is to update Phobos std.concurrency to become compatible with vibe.d

Sounds promising!

Nice! I remember him mentioning this some time ago and it's also about the approach for merging everything back together that I had in mind, too. Just the support for sending Isolated!T would still be nice to have, but that could be implemented as a wrapper around std.concurrency.

Re: FYI: Sean Kelly working on fiber enabled std.concurrency

On Tue, 04 Feb 2014 22:23:31 GMT, Dicebot wrote:

http://forum.dlang.org/post/fhaympiypfkwvztzvagc@forum.dlang.org

Says his motivation is to update Phobos std.concurrency to become compatible with vibe.d

Sounds promising!

I'm glad to hear about this. When discovering that D had built-in message passing concurrency my thoughts were:

  1. Wow, great!
  2. Why doesn't this support fibers?
  3. Oh, vibe.d's vibe.core.concurrency does, sweet!
  4. Why isn't this in std.concurrency?

Re: FYI: Sean Kelly working on fiber enabled std.concurrency

https://github.com/D-Programming-Language/phobos/pull/1910

Re: FYI: Sean Kelly working on fiber enabled std.concurrency

What's an Isolated!T? Is that for ownership transfer?

Re: FYI: Sean Kelly working on fiber enabled std.concurrency

Am 07.02.2014 02:45, schrieb Sean Kelly:

What's an Isolated!T? Is that for ownership transfer?

Exactly, that and also as a possible way to build up immutable
structures. It basically guarantees recursively that there is no mutable
aliasing with the outside world going on and comes in two forms:

  • "strongly isolated": Allows only types that contain either POD,
    other isolated references, or immutable references. This can be
    implicitly converted/moved to immutable and can be safely transferred
    between threads without shared or locking.
  • "weakly isolated": Also allows shared references. This cannot be
    converted to immutable, but can still be moved safely between threads.
    Together with support for array splitting and fusion, this provides a
    nice safe and efficient way for multi-threaded array operations.

This started as a little proof of concept for a possible D type modifier
to see how practical it is to work with and if a sound definition is
possible. Looks quite promising, except that it often scratched DMD's
limits w.r.t. templates and CTFE (in terms of compiler bugs), which is
why a few safety measures are still disabled.

Re: FYI: Sean Kelly working on fiber enabled std.concurrency

Awesome. I'd always wanted to add move semantics to std.concurrency but there wasn't anything like that already in Phobos and I just never got around to it. Please submit a bugzilla ticket or pull request or whatever you think is appropriate.