Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import core.thread;
- import std.stdio;
- class ThreadA : Thread {
- public this() {
- super(&run);
- }
- private void run() {
- for(uint i = 0; i < 10; i++) {
- Thread.sleep(30_000_000);
- writeln("ThreadA is runnin'.");
- }
- }
- }
- class ThreadB : Thread {
- public this() {
- super(&run);
- Thread a = new ThreadA();
- a.start();
- }
- private void run() {
- for(uint i = 0; i < 10; i++) {
- Thread.sleep(10_000_000);
- writeln("ThreadB is runnin'.");
- }
- }
- }
- int main(string[] args) {
- Thread b = new ThreadB();
- b.start();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment