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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,101c38a932801b81 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!e23g2000prf.googlegroups.com!not-for-mail From: Eric Hughes Newsgroups: comp.lang.ada Subject: Re: Semantics of statement reordering relevant to Ada.Real_Time Date: Sun, 30 Mar 2008 14:12:20 -0700 (PDT) Organization: http://groups.google.com Message-ID: <1e11c455-8cd3-4bb3-ab36-081455d2ae25@e23g2000prf.googlegroups.com> References: NNTP-Posting-Host: 166.70.57.218 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1206911540 21361 127.0.0.1 (30 Mar 2008 21:12:20 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 30 Mar 2008 21:12:20 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: e23g2000prf.googlegroups.com; posting-host=166.70.57.218; posting-account=5RIiTwoAAACt_Eu87gmPAJMoMTeMz-rn User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:20650 Date: 2008-03-30T14:12:20-07:00 List-Id: On Mar 30, 12:59 pm, Robert A Duff wrote: > The only thing that's guaranteed is I/O behavior, so you have to do some > I/O. Only? You can also count on task termination, no? Example code below. Eric with Ada.Real_Time ; with Ada.Text_IO ; procedure Foo is Val : Natural := 0 ; Start_T, End_T : Ada.Real_Time.Time ; use Ada.Real_Time ; begin declare task Start_Timer ; task body Start_Timer is begin Start_T := Ada.Real_Time.Clock ; end ; begin null ; end ; declare task Compute ; task body Compute is begin for K in 1 .. 10 loop for I in 1 .. 10_000 loop Val := Val + I * I ; end loop; end loop; end ; begin null ; end ; declare task End_Timer ; task body End_Timer is begin End_T := Ada.Real_Time.Clock ; end ; begin null ; end ; Ada.Text_IO.Put_Line( Natural'Image( Val ) ) ; Ada.Text_IO.Put_Line( Duration'Image( To_Duration( End_T - Start_T ) ) ) ; end Foo ;