import std.thread; /// Import thread functions from the standard library import std.stdio; /// Also import standard in/output functions class UselessThread : Thread { /// Create a new class (custom variable type), derived from the Thread class from std.thread Thread p; /// This is a member variable of the new data type UselessThread, ask line or google for more info this(Thread parent) { /// constructor p=parent; } int run() { p.wait(); /// Wait until the parent thread exits return 0; /// then return and exit too. } } int main() { /// Our main function UselessThread yawn; /// Create a new variable of type UselessThread yawn = new UselessThread (Thread.getThis()); /// and assign to it a new object of the type UselessThread yawn.start(); /// Start the "yawn" thread. writefln("Counting seconds!"); for (int i=1; i<=10; ++i) { yawn.wait(1000); writefln(i, " seconds passed!"); } return 0; }