stopInterval

Cancels a setInterval() timer

void
stopInterval
()

Parameters

threadId Tid

Thread id of the setInterval() timer to be cancelled

Examples

import nyinaa.timers: setInterval, stopInterval;

import std.stdio : writeln;
import std.datetime : msecs;
import std.concurrency : Tid;
import core.thread.osthread : Thread;

void main()
{
    Tid b = setInterval(1000.msecs, (){ writeln("Hello from spawned thread B"); });
    // Let wait for 2 seconds
    Thread.sleep(2000.msecs);

    // cancel timer
    stopInterval(b);
}

Meta