comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Basic question about select
Date: Thu, 29 Apr 2010 00:41:10 +0200
Date: 2010-04-29T00:41:07+02:00	[thread overview]
Message-ID: <li4owy33qsdk$.1h1n04y4qjtme.dlg@40tude.net> (raw)
In-Reply-To: hra886$nku$1@tornado.tornevall.net

On Wed, 28 Apr 2010 14:00:50 -0700, Jeffrey R. Carter wrote:

> Technically, though, it isn't quite true: if the entry call *completes* then the 
> abortable part (after "then abort") is aborted: "If the triggering_statement 
> completes other than due to cancellation, the abortable_part is aborted".

This is a very interesting question. I don't know if this wording indeed
requires the rendezvous and the abortable part to execute in parallel.
Otherwise, in effect, fetching the call from the queue must abort. I would
expect rather the latter, because the former would be quite difficult to
implement. The following example illustrates the case:

   protected Event is
      procedure Signal;
      entry Wait;
   private
      Signaled : Boolean := False;
   end Event;

   protected body Event is
      procedure Signal is
      begin
         Signaled := True;
      end Signal;
      entry Wait when Signaled is
      begin
         Signaled := False;
      end;
   end Event;
   
   task PID is
      entry Call;
   end PID;

   task body PID is
   begin
      accept Call do Event.Wait; end;
   end PID;

begin
  select
     PID.Call;  -- Blocked in the rendezvous
  then abort
     delay 2.0;
     Event.Signal; -- Releases the rendezvous after 2s
  end select;

If abort to happen after *completion* of the rendezvous then the above
shall not deadlock. (I checked this under GNAT/Windows, it deadlocks
there.)

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2010-04-28 22:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-28 18:16 Basic question about select John Wilkinson
2010-04-28 18:36 ` Dmitry A. Kazakov
2010-04-28 21:00   ` Jeffrey R. Carter
2010-04-28 22:41     ` Dmitry A. Kazakov [this message]
2010-04-29  0:20       ` Jeffrey R. Carter
2010-04-29  2:16         ` Adam Beneschan
2010-04-29  4:25           ` Jeffrey R. Carter
2010-04-29 17:27             ` Adam Beneschan
2010-04-29 18:42               ` Jeffrey R. Carter
2010-04-29  0:47       ` Jeffrey R. Carter
2010-04-29  7:37         ` Dmitry A. Kazakov
replies disabled

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