yage.core.async
Authors:
Eric Poggel
License:
LGPL v3
- Timeout!(T) setTimeout
(T)(float delay, T func,...);
- Call a function via a thread after a non-blocking delay.
TODO:
This should use closure instead of duplicating its functionality.
Params:
delay |
Wait this many seconds before calling func. |
func |
Function to call |
_args |
Argument list to pass to func. |
Returns:
a Timeout class that can be passed to clearTimeout.
Example:
void func(char[] s)
{ Stdout(s, t);
}
setTimeout(1, &func, "foo"); // call func with argument of "foo" after 1 second.
auto t = setTimeout(2, (char[] s, int t) { Stdout(s, t); }, "foo", 4);
clearTimeout(t); // cancel second timeout function.
- Timeout!(T) setInterval
(T)(float delay, T func,...);
- This function is the same as setTimeout, except that func
is called repeatedly after delay until clearInterval is called.
TODO:
Merge with repeater?
- void clearTimeout
(T)(Timeout!(T) t);
alias clearInterval
;
- Clear a timeout or interval that has previously been set.
Params:
t |
the return value of setTimeout or setInterval. |
|