From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,23ffa52608fbb144 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.191.225 with SMTP id hb1mr19417142pbc.5.1337494726682; Sat, 19 May 2012 23:18:46 -0700 (PDT) Path: pr3ni10845pbb.0!nntp.google.com!news2.google.com!goblin1!goblin.stu.neva.ru!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Problem with Delay Alternative in Finalization Date: Sun, 20 May 2012 07:17:50 +0100 Organization: A noiseless patient Spider Message-ID: References: <6v0er7d545kvs3pr7aqe1dnrlq4mg5ldhg@4ax.com> Mime-Version: 1.0 Injection-Info: mx04.eternal-september.org; posting-host="6b1ZqhDZGUFfTXBxmWG8Jw"; logging-data="23863"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+aVXH1oG/N9GIjoJFXUDiH1EwU3qjnjMw=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (darwin) Cancel-Lock: sha1:WPbAOeNjNNgh7O0P5wqghDOzMhs= sha1:0GvMyEyRodR2ANcGA+YAjQ8DJQU= Content-Type: text/plain; charset=us-ascii Date: 2012-05-20T07:17:50+01:00 List-Id: Simon Wright writes: > Tim McGuire 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;