Advertisement
Guest User

Untitled

a guest
Apr 29th, 2019
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ada 1.81 KB | None | 0 0
  1. with Ada.Text_IO;
  2. use Ada.Text_IO;
  3. with Ada.Real_Time;
  4. use Ada.Real_Time;
  5. procedure practica is
  6.  
  7.    task control_1;
  8.    task control_2;
  9.    task control_3;
  10.    task pantalla is
  11.       entry Mostrar(Control: Integer);
  12.    end pantalla;
  13.    
  14.    
  15.    
  16.    task body pantalla is
  17.    begin
  18.       accept Mostrar (Control : in Integer) do
  19.          null;
  20.       end Mostrar;
  21.      
  22.       loop
  23.          accept Mostrar(Control : Integer) do
  24.             Put_Line(Control'Img);
  25.             if Control = 1 then
  26.                Put_Line("Calculando control h1");
  27.             elsif Control = 2 then
  28.                Put_Line("Calculando control h2");
  29.             else
  30.                Put_Line("Calculando control T1");
  31.             end if;
  32.          end Mostrar;
  33.       end loop;
  34.    end pantalla;
  35.    
  36.    
  37.    
  38.    task body control_1 is
  39.       T1 : Time_Span;
  40.       tiempo1 : Time;
  41.    begin
  42.       T1 := Milliseconds(1000);
  43.       tiempo1:= Clock;
  44.       loop
  45.          --Put_Line("Calculando control h1");
  46.          pantalla.Mostrar(1);
  47.          Delay Until(tiempo1);
  48.          tiempo1 := tiempo1 + T1;
  49.       end loop;
  50.    end control_1;
  51.  
  52.    task body control_2 is
  53.       T2 : Time_Span;
  54.       tiempo2 : Time;
  55.    begin
  56.       T2 := Milliseconds(2000);
  57.       tiempo2:= Clock;
  58.       loop
  59.          --Put_Line("Calculando control h2");
  60.          pantalla.Mostrar(2);
  61.          delay until(tiempo2);
  62.          tiempo2 := tiempo2 + T2;
  63.       end loop;
  64.    end control_2;
  65.  
  66.    task body control_3 is
  67.       T3 : Time_Span;
  68.       tiempo3 : Time;
  69.    begin
  70.       T3 := Milliseconds(3000);
  71.       tiempo3:= Clock;
  72.       loop
  73.          --Put_Line("Calculando control T1");
  74.          pantalla.Mostrar(3);
  75.          delay until(tiempo3);
  76.          tiempo3 := tiempo3 + T3;
  77.       end loop;
  78.    end control_3;
  79.  
  80. begin
  81.    null;
  82. end practica;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement