Task

Using either native language concurrency syntax or freely available libraries, write a program to display the strings "Enjoy" "Rosetta" "Code", one string per line, in random order.

Concurrency syntax must use threads, tasks, co-routines, or whatever concurrency is called in your language.




 
bundle Default {
  class MyThread from Thread {
    New(name : String) {
      Parent(name);
    }
 
    method : public : Run(param : Base) ~ Nil {
      string := param->As(String);
      string->PrintLine();
    }
  }
 
  class Concurrent {
    New() {
    }
 
    function : Main(args : System.String[]) ~ Nil {
      t0 := MyThread->New("t0");
      t1 := MyThread->New("t1");
      t2 := MyThread->New("t2");
 
      t0->Execute("Enjoy"->As(Base));
      t1->Execute("Rosetta"->As(Base));
      t2->Execute("Code"->As(Base));
    }
  }
}
 