Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with Ada.Text_IO;
- use Ada.Text_IO;
- with Ada.Real_Time;
- use Ada.Real_Time;
- procedure practica is
- task control_1;
- task control_2;
- task control_3;
- task pantalla is
- entry Mostrar(Control: Integer);
- end pantalla;
- task body pantalla is
- begin
- accept Mostrar (Control : in Integer) do
- null;
- end Mostrar;
- loop
- accept Mostrar(Control : Integer) do
- Put_Line(Control'Img);
- if Control = 1 then
- Put_Line("Calculando control h1");
- elsif Control = 2 then
- Put_Line("Calculando control h2");
- else
- Put_Line("Calculando control T1");
- end if;
- end Mostrar;
- end loop;
- end pantalla;
- task body control_1 is
- T1 : Time_Span;
- tiempo1 : Time;
- begin
- T1 := Milliseconds(1000);
- tiempo1:= Clock;
- loop
- --Put_Line("Calculando control h1");
- pantalla.Mostrar(1);
- Delay Until(tiempo1);
- tiempo1 := tiempo1 + T1;
- end loop;
- end control_1;
- task body control_2 is
- T2 : Time_Span;
- tiempo2 : Time;
- begin
- T2 := Milliseconds(2000);
- tiempo2:= Clock;
- loop
- --Put_Line("Calculando control h2");
- pantalla.Mostrar(2);
- delay until(tiempo2);
- tiempo2 := tiempo2 + T2;
- end loop;
- end control_2;
- task body control_3 is
- T3 : Time_Span;
- tiempo3 : Time;
- begin
- T3 := Milliseconds(3000);
- tiempo3:= Clock;
- loop
- --Put_Line("Calculando control T1");
- pantalla.Mostrar(3);
- delay until(tiempo3);
- tiempo3 := tiempo3 + T3;
- end loop;
- end control_3;
- begin
- null;
- end practica;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement