vibe.d beta banner
get vibe.d
0.10.0

Asynchronous I/O that doesn’t get in your way, written in D

Function sleep

Suspends the execution of the calling task for the specified amount of time.

void sleep (
  core.time.Duration timeout
) @safe;

Note that other tasks of the same thread will continue to run during the wait time, in contrast to core.thread.Thread.sleep, which shouldn't be used in vibe.d applications.

Throws

May throw an InterruptException if the task gets interrupted using Task.interrupt().

Example

import vibe.core.core : sleep;
import vibe.core.log : logInfo;
import core.time : msecs;

void test()
{
	logInfo("Sleeping for half a second...");
	sleep(500.msecs);
	logInfo("Done sleeping.");
}
Authors

Sönke Ludwig

Copyright

© 2012-2019 RejectedSoftware e.K.

License

Subject to the terms of the MIT license, as written in the included LICENSE.txt file.