Function ITaskManager.setTimer

Run an asynchronous task after a given time.

ITimer setTimer (
  core.time.Duration timeout,
  nothrow @safe void delegate() dg,
  Periodic periodic = Periodic.No
) nothrow @safe;

final ITimer setTimer (
  core.time.Duration timeout,
  void delegate() dg,
  Periodic periodic = Periodic.No
) nothrow @safe;

The task will first run after the given timeout, and can either repeat or run only once (the default).

Currently non @safe and non nothrow handlers are allowed but not recommended. It might be deprecated in the future.

See Also

https://vibed.org/api/vibe.core.core/setTimer

Parameters

NameDescription
timeout Determines the minimum amount of time that elapses before the timer fires.
dg This delegate will be called when the timer fires. It is recommended to provide a @safe and nothrow handler.
periodic Specifies if the timer fires repeatedly or only once.

Returns

An ITimer interface with the ability to control the timer