import std.stdio; import core.time : Duration, dur; import vibe.core.core; import vibe.core.concurrency; void test8_spawner(){ auto val = async({ //logInfo("Starting to compute value in worker task."); writeln("Starting to compute value in worker task."); sleep(dur!"msecs"(500)); writeln("Finished computing value in worker task."); return 32; }); writeln("Starting computation in main task"); sleep(dur!"msecs"(200)); writeln("Finished computation in main task. Waiting for async value."); writeln("Result: ", val.getResult()); } /* ./vtest2 hello here! Starting to compute value in worker task. Starting computation in main task Finished computation in main task. Waiting for async value. Finished computing value in worker task. Result: 32 */