comp.lang.ada
 help / color / mirror / Atom feed
From: lutz@iks-jena.de (Lutz Donnerhacke)
Subject: Re: Same two tasks in two rendezvous?
Date: Tue, 31 Jul 2001 10:02:43 +0000 (UTC)
Date: 2001-07-31T10:02:43+00:00	[thread overview]
Message-ID: <slrn9md0bi.hv.lutz@taranis.iks-jena.de> (raw)
In-Reply-To: b4682ab7.0107300855.2232cad1@posting.google.com

* Adam Beneschan wrote:
>Is it possible for two tasks, T1 and T2, to be in two rendezvous with
>each other simultaneously?

No.

>Is this what should actually happen?

Deadlock.

>Is there anything in the language that prohibits this from happening?

No, because it's possible to open the deadlock by a third task.
\f
with Ada.Text_IO;
use Ada.Text_IO;

procedure t is
   task type rev is
      entry e1;
      entry e2;
   end;
   
   task body rev is
   begin
      Put_Line ("Starting task");
      accept e1 do
         Put_Line ("Entry E1");
         accept e2 do
            Put_Line ("Entry E2");
         end e2;
      end e1;
      Put_Line ("Stopping task");
   end;
   
   e : rev;
   
   task type helper;
   task body helper is
   begin
      Put_Line ("Starting helper task");
      e.e2;
      Put_Line ("Stopping helper task");
   end helper;
   
   h : helper;                      --  comment this out to see what happens
      
begin
   Put_Line ("First Rendevous");
   e.e1;
   Put_Line ("Second Rendevous");   --  comment this out to see what happens
   e.e2;                            --  comment this out to see what happens
   Put_Line ("Stopping Main Task");
end t;



      reply	other threads:[~2001-07-31 10:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-30 16:55 Same two tasks in two rendezvous? Adam Beneschan
2001-07-31 10:02 ` Lutz Donnerhacke [this message]
replies disabled

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