comp.lang.ada
 help / color / mirror / Atom feed
* passing messages between the tasks
@ 2014-10-14  1:17 compguy45
  2014-10-14  1:49 ` Adam Beneschan
  0 siblings, 1 reply; 18+ messages in thread
From: compguy45 @ 2014-10-14  1:17 UTC (permalink / raw)


I understand in this example that calling tasks(main or environmental task) is passing id value to 2 tasks...In regarding to code below I have 2 question and was hoping someone can answer....

  1 with Ada.Text_IO, Ada.Integer_Text_IO;
  2 use Ada.Text_IO, Ada.Integer_Text_IO;
  3 
  4 procedure SomeProcedure is
  5 
  6 task type lamp is
  7    entry reset(id : Integer);
  8 end lamp;
  9 
 10 lamps : array (1..6) of lamp;
 11 
 12    task body lamp is
 13    begin
 14       Put_Line("Body of task lamp");
 15       accept reset(id : Integer) do
 16         put("inside reset");
 17         put(id);
 18         New_Line;
 19       end reset;
 20       delay 4.0;
 21    put("after accept");
 22    end lamp;
 23 
 24 begin
 25    lamps(1).reset(id => 1);
 26    lamps(2).reset(id => 2);
 27 end SomeProcedure;

1. How would would these 2 tasks send message back to main? For example how would each of these two lamp tasks send "i received call to my acceptstatement");

2. If there are some variables inside the body of the task to be saved and they might be different for each of these tasks how to save these values?


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2014-10-15  1:07 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-14  1:17 passing messages between the tasks compguy45
2014-10-14  1:49 ` Adam Beneschan
2014-10-14  1:55   ` compguy45
2014-10-14  2:09   ` compguy45
2014-10-14  2:14     ` Adam Beneschan
2014-10-14  2:15       ` compguy45
2014-10-14  7:36         ` mockturtle
2014-10-14 15:30           ` compguy45
2014-10-14 16:25             ` mockturtle
2014-10-14 20:33             ` Shark8
2014-10-14 19:43   ` Shark8
2014-10-14 20:42     ` Jeffrey Carter
2014-10-14 21:08       ` compguy45
2014-10-14 21:58         ` compguy45
2014-10-14 23:03           ` Jeffrey Carter
2014-10-14 22:22         ` Shark8
2014-10-14 23:49         ` Dennis Lee Bieber
2014-10-15  1:07         ` Dennis Lee Bieber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox