Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Ada > Re: Semantics o...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 14 of 15 Topic 5622 of 5831
Post > Topic >>

Re: Semantics of statement reordering relevant to Ada.Real_Time

by Eric Hughes <eric.eh9@[EMAIL PROTECTED] > Mar 30, 2008 at 02:12 PM

On Mar 30, 12:59 pm, Robert A Duff <bobd...@[EMAIL PROTECTED]
>
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 ;
 




 15 Posts in Topic:
Ada.Real_Time behavior with GNAT
kongra <kongra@[EMAIL   2008-03-29 06:51:58 
Re: Ada.Real_Time behavior with GNAT
george.priv@[EMAIL PROTEC  2008-03-29 09:50:56 
Re: Ada.Real_Time behavior with GNAT
Georg Bauhaus <rm.tsoh  2008-03-29 18:29:48 
Re: Ada.Real_Time behavior with GNAT
Simon Wright <simon.j.  2008-03-29 18:11:29 
Re: Ada.Real_Time behavior with GNAT
"Dmitry A. Kazakov&q  2008-03-29 19:25:05 
Re: Ada.Real_Time behavior with GNAT
george.priv@[EMAIL PROTEC  2008-03-29 12:06:38 
Re: Ada.Real_Time behavior with GNAT
Konrad Grzanek <kongra  2008-03-29 12:15:41 
Re: Ada.Real_Time behavior with GNAT
Konrad Grzanek <kongra  2008-03-29 12:46:16 
Re: Ada.Real_Time behavior with GNAT
Georg Bauhaus <rm.tsoh  2008-03-30 01:14:29 
Re: Ada.Real_Time behavior with GNAT
george.priv@[EMAIL PROTEC  2008-03-29 14:21:45 
Re: Ada.Real_Time behavior with GNAT
Konrad Grzanek <kongra  2008-03-29 14:49:16 
Semantics of statement reordering relevant to Ada.Real_Time
Eric Hughes <eric.eh9@  2008-03-30 10:12:25 
Re: Semantics of statement reordering relevant to Ada.Real_Time
Robert A Duff <bobduff  2008-03-30 14:59:21 
Re: Semantics of statement reordering relevant to Ada.Real_Time
Eric Hughes <eric.eh9@  2008-03-30 14:12:20 
Re: Semantics of statement reordering relevant to Ada.Real_Time
Robert A Duff <bobduff  2008-03-30 17:28:19 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 20:48:13 CDT 2008.