On Mon, 27 Oct 2014 21:58:55 GMT, WhatMeWorry wrote:
My naive attempt below compiles and links but just results in an default output window which just hangs. Anybody know of the correct usage of setTimer() and runEvenLoop()?
import std.stdio;
import std.functional;
import vibe.core.core;
import core.time;void printTime()
{
import std.datetime;
writeln("The time is: %s", Clock.currTime() );
}void testTimer()
{
import vibe.core.core;
setTimer(5.seconds, toDelegate(&printTime), true);
}int main(string[] argv)
{
runEventLoop();testTimer();
while(true){}
return 0;
}thanks.
runEventLoop
blocks until the application gets quit using either Ctrl+C or using exitEventLoop()
. Putting it at the end should make this work:
void main()
{
testTimer();
runEventLoop();
}