vibe.d is blocking threads

RuZzz via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Apr 27 06:00:29 PDT 2016


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.

- Gentoo Linux 64
- DMD64 D Compiler v2.069.0 (dub dependency)
- DMD64 D Compiler v2.071.0
- dub-0.9.24 USE="dmd-2_069"

dub.json:
{
   "name" : "axt-threads-json",
   "description" : "A minimal D bundle.",
   "targetType": "executable",
   "targetPath": "bin",
   "dependencies" : {
       "vibe-d": "~>0.7.28",
   },
   "configurations": [
             {
                 "name": "Debuger"
             },
             {
                 "name": "Release"
             }
     ]
}


More information about the Digitalmars-d-learn mailing list