File : a-retide-raven.adb


   1 ------------------------------------------------------------------------------
   2 --                                                                          --
   3 --                  GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS                --
   4 --                                                                          --
   5 --                   A D A . R E A L _ T I M E . D E L A Y S                --
   6 --                                                                          --
   7 --                                  B o d y                                 --
   8 --                                                                          --
   9 --                     Copyright (C) 2001-2010, AdaCore                     --
  10 --                                                                          --
  11 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
  12 -- terms of the  GNU General Public License as published  by the Free Soft- --
  13 -- ware  Foundation;  either version 3,  or (at your option) any later ver- --
  14 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
  15 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
  16 -- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
  17 --                                                                          --
  18 --                                                                          --
  19 --                                                                          --
  20 --                                                                          --
  21 --                                                                          --
  22 -- You should have received a copy of the GNU General Public License and    --
  23 -- a copy of the GCC Runtime Library Exception along with this program;     --
  24 -- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
  25 -- <http://www.gnu.org/licenses/>.                                          --
  26 --                                                                          --
  27 -- GNARL was developed by the GNARL team at Florida State University.       --
  28 -- Extensive contributions were provided by Ada Core Technologies, Inc.     --
  29 --                                                                          --
  30 ------------------------------------------------------------------------------
  31 
  32 with System.Task_Primitives.Operations;
  33 --  Used for Timed_Delay
  34 --           Self
  35 
  36 package body Ada.Real_Time.Delays is
  37 
  38    package STPO renames System.Task_Primitives.Operations;
  39 
  40    -----------------
  41    -- Delay_Until --
  42    -----------------
  43 
  44    procedure Delay_Until (T : Time) is
  45    begin
  46       --  pragma Detect_Blocking is mandatory in this run time, so that
  47       --  Program_Error must be raised if this delay (potentially blocking
  48       --  operation) is called from a protected operation.
  49 
  50       if STPO.Self.Common.Protected_Action_Nesting > 0 then
  51          raise Program_Error;
  52       else
  53          STPO.Delay_Until (STPO.Time (T));
  54       end if;
  55    end Delay_Until;
  56 
  57    -----------------
  58    -- To_Duration --
  59    -----------------
  60 
  61    --  This function is not supposed to be used by the Ravenscar run time and
  62    --  it is not supposed to be with'ed by the user either (because it is an
  63    --  internal GNAT unit). It is kept here (returning a junk value) just for
  64    --  sharing the same package specification with the regular run time.
  65 
  66    function To_Duration (T : Time) return Duration is
  67       pragma Unreferenced (T);
  68    begin
  69       return 0.0;
  70    end To_Duration;
  71 
  72 end Ada.Real_Time.Delays;