ScheduledFiber

A Fiber paired with a long UNIX timestamp.

If we bundle the two together like this, we can associate a point in time with a Fiber without having to to use an associative array (with UNIX timestamp keys).

Constructors

this
this(Fiber fiber, long timestamp, string creator)

Constructor.

Members

Functions

toString
auto toString()

Dummy toString to stop std.conv.to from generating one.

Variables

creator
string creator;

String name of the function that created this ScheduledFiber.

fiber
Fiber fiber;

Fiber to trigger at the point in time timestamp.

timestamp
long timestamp;

When fiber is scheduled to be called, in hnsecs from midnight Jan 1st 1970.

Examples

import std.datetime.systime : Clock;
import core.thread.fiber : Fiber;

void dg() { /* ... */ }

auto scheduledFiber = ScheduledFiber(new Fiber(&dg, BufferSize.fiberStack),
    Clock.currTime.stdTime + 10 * 10_000_000);  // ten seconds in hnsecs