vibe.d is blocking threads

Nicholas Wilson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Apr 27 16:30:10 PDT 2016


On Wednesday, 27 April 2016 at 13:00:29 UTC, RuZzz wrote:
> Code:
>     import std.concurrency;
>     import core.thread;
>     //import vibe.http.client;      // If uncommented this 
> line, the thread "worker" does not start
>     void worker() {
>         foreach (i; 0 .. 5) {
>             Thread.sleep(500.msecs);
>             writeln(i, " (worker)");
>         }
>     }
>
>     void main() {
>         spawn(&worker);
>
>         foreach (i; 0 .. 5) {
>             Thread.sleep(300.msecs);
>             writeln(i, " (main)");
>         }
>
>         writeln("main is done.");
>     }
>
> How to launch threads with vibe.d? It doesn't work at both 
> compilers.

You don't. vibe.d uses fibers (aka green threads).



More information about the Digitalmars-d-learn mailing list