From Subtle Tortoise, 1 Year ago, written in Ada.
This paste will expire in 1 Second.
Embed
  1. with Ada.Text_IO;
  2. with Ada.Calendar.Formatting;
  3.  
  4. procedure Main is
  5.    task type Worker with Storage_Size => 1024 is
  6.       entry Start;
  7.       entry Stop;
  8.    end Worker;
  9.    
  10.    task body Worker is
  11.    begin
  12.       accept Start;
  13.       accept Stop;
  14.    end Worker;
  15.    
  16.    Workers : array (1 .. 9_000) of Worker;
  17. begin
  18.    Ada.Text_IO.Put_Line
  19.      (Ada.Calendar.Formatting.Image (Ada.Calendar.Clock)
  20.       & " Starting...");
  21.    
  22.    for W of Workers loop
  23.       W.Start;
  24.    end loop;
  25.  
  26.    Ada.Text_IO.Put_Line
  27.      (Ada.Calendar.Formatting.Image (Ada.Calendar.Clock)
  28.       & " Started!");
  29.    
  30.    delay 30.0;
  31.    
  32.    Ada.Text_IO.Put_Line
  33.      (Ada.Calendar.Formatting.Image (Ada.Calendar.Clock)
  34.       & " Stoping...");
  35.  
  36.    for W of Workers loop
  37.       W.Stop;
  38.    end loop;
  39.  
  40.    Ada.Text_IO.Put_Line
  41.      (Ada.Calendar.Formatting.Image (Ada.Calendar.Clock)
  42.       & " Stopped!");
  43.    
  44. end Main;
  45.