comp.lang.ada
 help / color / mirror / Atom feed
From: compguy45@gmail.com
Subject: passing messages between the tasks
Date: Mon, 13 Oct 2014 18:17:28 -0700 (PDT)
Date: 2014-10-13T18:17:28-07:00	[thread overview]
Message-ID: <b7a2745e-a0df-400b-a057-828473919fee@googlegroups.com> (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?


             reply	other threads:[~2014-10-14  1:17 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-14  1:17 compguy45 [this message]
2014-10-14  1:49 ` passing messages between the tasks 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
replies disabled

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