On Wednesday, 27 January 2016 at 09:33:16 UTC, Kagamin wrote:
On Tuesday, 26 January 2016 at 20:33:34 UTC, Chris Wright wrote:
You can use fibers in C++ if you find a library to do it
(boost might?). You might be able to find a Java library for
it, but it's difficult and might require bytecode rewriting.
The java approach is Netty and NIO.
Netty and NIO are an event dispatching mechanism (think
libebevent) backed by a ForkJoinPool. No fibers there. Java
/does/ have fibers in Quasar, though the implementation is a bit
weird because the Java instruction set doesn't support
continuations.
Message passing via std.concurrency is important to note. The
scheduler is pluggable and can seamlessly multiplex fibers on top
of a thread pool (the Erlang "millions of threads" approach).
Thread local by default is notable as well, though fibers throw a
wrench in this. The "synchronized" keyword is inadvisable in
modern concurrent programming. I think it remains largely to ease
porting code from Java.