How to resolve the algorithm Concurrent computing step by step in the Objeck programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Concurrent computing step by step in the Objeck programming language

Table of Contents

Problem Statement

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.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Concurrent computing step by step in the Objeck programming language

Source code in the objeck programming 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));
    }
  }
}

  

You may also check:How to resolve the algorithm Polynomial regression step by step in the Modula-2 programming language
You may also check:How to resolve the algorithm Y combinator step by step in the Oforth programming language
You may also check:How to resolve the algorithm Harshad or Niven series step by step in the XPL0 programming language
You may also check:How to resolve the algorithm Semiprime step by step in the Arturo programming language
You may also check:How to resolve the algorithm Gapful numbers step by step in the Elixir programming language