On Fri, 03 May 2013 16:28:40 GMT, Jack Applegame wrote:
Seems like TaskMutex/TaskCondition is broken.
import vibe.d; shared static this() { bool flag = false; TaskCondition cv = new TaskCondition(new TaskMutex); runTask({ synchronized(cv.mutex) { while(!flag) cv.wait(); } logInfo("notified"); }); runTask({ synchronized(cv.mutex) { flag = true; cv.notify(); } logInfo("notify"); }); }
outputs
notify
It looks like libevent loses the events that should cause receive
/TaskCondition.wait
to stop waiting whenever the initial wait happens before the event loop has been started. I'll look into this. For now there are two workarounds:
- Put f.ex.
sleep(1.seconds());
before the firstreceive
call or use a timer with zero timeout to start the tasks after the event loop has started - Use
"subConfigurations": { "vibe-d": "win32" }
in package.json to switch to the win32 driver, which doesn't suffer from the issue