OSDN Git Service

* gcc-interface/Make-lang.in: Fix typo.
[pf3gnuchains/gcc-fork.git] / gcc / ada / s-gloloc.adb
index b1fe1b3..331e67f 100644 (file)
@@ -6,39 +6,35 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---                                                                          --
---          Copyright (C) 1999-2001 Free Software Foundation, Inc.          --
+--          Copyright (C) 1999-2009, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
--- ware  Foundation;  either version 2,  or (at your option) any later ver- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
--- for  more details.  You should have  received  a copy of the GNU General --
--- Public License  distributed with GNAT;  see file COPYING.  If not, write --
--- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
--- MA 02111-1307, USA.                                                      --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
 --                                                                          --
--- As a special exception,  if other files  instantiate  generics from this --
--- unit, or you link  this unit with other files  to produce an executable, --
--- this  unit  does not  by itself cause  the resulting  executable  to  be --
--- covered  by the  GNU  General  Public  License.  This exception does not --
--- however invalidate  any other reasons why  the executable file  might be --
--- covered by the  GNU Public License.                                      --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
 --                                                                          --
--- GNAT is maintained by Ada Core Technologies Inc (http://www.gnat.com).   --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
 --                                                                          --
 ------------------------------------------------------------------------------
 
-with GNAT.Task_Lock;
+with System.Soft_Links;
 
 package body System.Global_Locks is
 
    type String_Access is access String;
 
-   package TSL renames GNAT.Task_Lock;
-
    Dir_Separator : Character;
    pragma Import (C, Dir_Separator, "__gnat_dir_separator");
 
@@ -65,8 +61,7 @@ package body System.Global_Locks is
    -- Acquire_Lock --
    ------------------
 
-   procedure Acquire_Lock
-     (Lock : in out Lock_Type) is
+   procedure Acquire_Lock (Lock : in out Lock_Type) is
    begin
       Lock_File
         (Lock_Table (Lock).Dir.all,
@@ -77,17 +72,14 @@ package body System.Global_Locks is
    -- Create_Lock --
    -----------------
 
-   procedure Create_Lock
-     (Lock : out Lock_Type;
-      Name : in String)
-   is
+   procedure Create_Lock (Lock : out Lock_Type; Name : String) is
       L : Lock_Type;
 
    begin
-      TSL.Lock;
+      System.Soft_Links.Lock_Task.all;
       Last_Lock := Last_Lock + 1;
       L := Last_Lock;
-      TSL.Unlock;
+      System.Soft_Links.Unlock_Task.all;
 
       if L > Lock_Table'Last then
          raise Lock_Error;
@@ -95,10 +87,8 @@ package body System.Global_Locks is
 
       for J in reverse Name'Range loop
          if Name (J) = Dir_Separator then
-            Lock_Table (L).Dir
-              := new String'(Name (Name'First .. J - 1));
-            Lock_Table (L).File
-              := new String'(Name (J + 1 .. Name'Last));
+            Lock_Table (L).Dir := new String'(Name (Name'First .. J - 1));
+            Lock_Table (L).File := new String'(Name (J + 1 .. Name'Last));
             exit;
          end if;
       end loop;
@@ -132,9 +122,11 @@ package body System.Global_Locks is
          if Try_Lock (C_Dir'Address, C_File'Address) = 1 then
             return;
          end if;
+
          exit when I = Retries;
          delay Wait;
       end loop;
+
       raise Lock_Error;
    end Lock_File;
 
@@ -142,12 +134,10 @@ package body System.Global_Locks is
    -- Release_Lock --
    ------------------
 
-   procedure Release_Lock
-     (Lock : in out Lock_Type)
-   is
+   procedure Release_Lock (Lock : in out Lock_Type) is
       S : aliased String :=
-        Lock_Table (Lock).Dir.all & Dir_Separator &
-        Lock_Table (Lock).File.all & ASCII.NUL;
+            Lock_Table (Lock).Dir.all & Dir_Separator &
+            Lock_Table (Lock).File.all & ASCII.NUL;
 
       procedure unlink (A : System.Address);
       pragma Import (C, unlink, "unlink");