comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Problem with Delay Alternative in Finalization
Date: Sun, 20 May 2012 07:17:50 +0100
Date: 2012-05-20T07:17:50+01:00	[thread overview]
Message-ID: <m2r4ufv0j5.fsf@pushface.org> (raw)
In-Reply-To: m2r4ug848u.fsf@nidhoggr.home

Simon Wright <simon@pushface.org> writes:

> Tim McGuire <mcguire_tm2@yahoo.com> writes:
>
>> I am running in to a problem where a delay alternive used when in
>> finalization doesn't seem to be working properly.
>> The delay part never seems to happen.
>
> I ran this (after correcting a couple of minor compilation problems) on
> a Mac. Using both GNAT GPL 2011 and GCC 4.7.0, the appearance on-screen
> is as though the timeout didn't occur:
>
>    $ ./token_test 
>    Got Token
>    Token timed out!
>
> With both compilers, the debugger shows that the Lock_Timeout_Exception
> did in fact happen. What happens next is confused .. Dmitry is probably
> right.

D'oh.

At 3 a.m. I realised what the problem is (at any rate, with the example
code; not sure whether this would affect the real thing).

As Bob Duff has already said, the exception when tryining to initialise
Token_2 means that the declare block is never entered. Try

   declare
      Token : Test_Lock_Token.Lock_Token;
   begin
      Ada.Text_IO.Put_Line ("Got Token");
      begin
         declare
            Token_2 : Test_Lock_Token.Lock_Token;
         begin
            null;
         end;
         Ada.Text_IO.Put_Line ("Got Token_2");
      exception
         when Errors : Test_Lock_Token.Lock_Timeout_Exception =>
            Ada.Text_IO.Put_Line ("Token_2 timed out!");
      end;
   exception
      when Errors : Test_Lock_Token.Lock_Timeout_Exception =>
         Ada.Text_IO.Put_Line("Token timed out!");
   end;



  reply	other threads:[~2012-05-20  6:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-19  2:30 Problem with Delay Alternative in Finalization Tim McGuire
2012-05-19  6:12 ` Dmitry A. Kazakov
2012-05-19 12:51   ` Tim McGuire
2012-05-19 14:04     ` Dmitry A. Kazakov
2012-05-19 19:46   ` Robert Matthews
2012-05-20 16:46     ` Tim McGuire
2012-05-20 17:01       ` Dmitry A. Kazakov
2012-05-20 20:36         ` Simon Wright
2012-05-19 17:33 ` Simon Wright
2012-05-20  6:17   ` Simon Wright [this message]
2012-05-19 20:31 ` Robert A Duff
replies disabled

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