This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Ada] AI 297


Hi Arnaud,

> The language-defined package Ada.Real_Time.Timing_Events is part of
> the recent revision of Ada and is defined by AI95-00297, available at
> http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AIs/AI-00297.TXT.
> The package defines a type Timing_Event, objects of which represent
> times in the future when events are to occur.  In particular, these
> objects cause user-defined protected procedures to be executed at a
> specified time without the need to use a task or a delay statement.
> This particular implementation is suitable for general purpose
> operating systems and provides the required functionality in a manner
> sufficient for development and functional testing.  An implementation
> intended for a real-time operating system would use a different
> strategy and would, in particular, invoke the protected procedures in
> the context of a timer interrupt handler.

are you planning to develop a more sophisticated linux version?

Also, isn't the call on the entry Event.Control.Set a potentially
blocking operation?  According to the RM, Set_Handler is *not*
potentially blocking.

+   -----------------
+   -- Set_Handler --
+   -----------------
+
+   procedure Set_Handler
+     (Event   : in out Timing_Event;
+      In_Time : Time_Span;
+      Handler : Timing_Event_Handler)
+   is
+   begin
+      Event.Control.Cancel;
+
+      if In_Time <= Time_Span_Zero then
+         if Handler /= null then
+            Handler (Event);
+         end if;
+         return;
+      end if;
+
+      if Handler /= null then
+         Event.Control.Set (Clock + In_Time, Handler); <= Potentially blocking!
+         Event_Queue.Insert (Event'Unchecked_Access);
+      end if;
+   end Set_Handler;


All the best,

Duncan.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]