What are the real advantages that D offers in multithreading?
Brad Anderson via Digitalmars-d
digitalmars-d at puremagic.com
Thu Jan 28 12:34:41 PST 2016
On Thursday, 28 January 2016 at 10:26:29 UTC, Kagamin wrote:
> On Wednesday, 27 January 2016 at 17:30:28 UTC, Brad Anderson
> wrote:
>> Yeah, boost can do fibers. ASIO has clever/hacky "stackless
>> coroutines" and C++17 is going to add "stackless resumable
>> functions" for async/await. D is about to lose a competitive
>> advantage here.
>
> Isn't asio based on fibers just like vibe?
No, it's primarily a callback oriented interface. Boost.Fiber
(which is relatively new) added some stuff so you could use
something more like vibe.d with ASIO. ASIO has had a "stackless
coroutine" option since 1.42, I think. They are, like I said,
very clever and hacky. It uses preprocessor macros to define new
"keywords". They use switches and loops under the hood to appears
as coroutines[1]. It's an impressive idea but language supported
coroutines would be a lot better.
ASIO is serving as the basis for C++17's network library. The
co-routines are still being argued about but if the design gets
nailed down before then I'm sure the C++17 networking library
will make use of the feature.
1. http://www.boost.org/doc/libs/1_56_0/boost/asio/coroutine.hpp
More information about the Digitalmars-d
mailing list