On Fri, 17 Mar 2017 21:09:12 +0100, Sönke Ludwig wrote:

This should be fixed/implemented for the new vibe-core package, which
is not yet the default in 0.8.0. Try adding this to the package recipe
to force using vibe-core:

dependency "vibe-d:core" version="~>0.8.0-beta"
subConfiguration "vibe-d:core" "vibe-core"

OK, I modified the example to find out what was going on, because with this configuration it's hanging. Here's my code.

import vibe.core.core;
import vibe.core.log;

void busywait(long msecs) {
    import std.datetime;
    StopWatch sw;
    sw.start();
    ulong i;
    logInfo("start waiting");
    while( sw.peek().msecs < msecs) {
        if( i%10000 == 0 ) logInfo("running %s msecs", sw.peek().msecs);
        ++i;
    }
    logInfo("done waiting");
}

void test()
{
    auto val = async({
        logInfo("Starting to compute value in worker task.");
//sleep(500.msecs); // simulate some lengthy computation
        	busywait(500);
		logInfo("Finished computing value in worker task.");
		return 32;
	});

	logInfo("Starting computation in main task");
	sleep(200.msecs); // simulate some lengthy computation
	logInfo("Finished computation in main task. Waiting for async value.");
	logInfo("Result: %s", val.getResult());
}

The log output never got as far as "Finished computing value in worker task." and the busywait call's output stopped after 203 msecs. So it seems the call of getResult causes the asynchronous task to hang.