-- --
-- B o d y --
-- --
--- Copyright (C) 1999-2001 Ada Core Technologies, Inc. --
+-- Copyright (C) 1999-2008, AdaCore --
-- --
-- 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- --
-- --
------------------------------------------------------------------------------
--- This implementation is specific to NT.
+-- This implementation is specific to NT
-with GNAT.Task_Lock;
+with System.OS_Interface;
+with System.Task_Lock;
+with System.Win32;
with Interfaces.C.Strings;
-with System.OS_Interface;
package body System.Global_Locks is
- package TSL renames GNAT.Task_Lock;
+ package TSL renames System.Task_Lock;
package OSI renames System.OS_Interface;
package ICS renames Interfaces.C.Strings;
- subtype Lock_File_Entry is OSI.HANDLE;
+ subtype Lock_File_Entry is Win32.HANDLE;
Last_Lock : Lock_Type := Null_Lock;
Lock_Table : array (Lock_Type range 1 .. 15) of Lock_File_Entry;
-- 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
end if;
Lock_Table (L) :=
- OSI.CreateMutex (null, OSI.BOOL (False), ICS.New_String (Name));
+ OSI.CreateMutex (null, Win32.FALSE, ICS.New_String (Name));
Lock := L;
end Create_Lock;
-- Acquire_Lock --
------------------
- procedure Acquire_Lock
- (Lock : in out Lock_Type)
- is
- use type OSI.DWORD;
+ procedure Acquire_Lock (Lock : in out Lock_Type) is
+ use type Win32.DWORD;
+
+ Res : Win32.DWORD;
- Res : OSI.DWORD;
begin
Res := OSI.WaitForSingleObject (Lock_Table (Lock), OSI.Wait_Infinite);
-- Release_Lock --
------------------
- procedure Release_Lock
- (Lock : in out Lock_Type)
- is
- use type OSI.BOOL;
+ procedure Release_Lock (Lock : in out Lock_Type) is
+ use type Win32.BOOL;
+
+ Res : Win32.BOOL;
- Res : OSI.BOOL;
begin
Res := OSI.ReleaseMutex (Lock_Table (Lock));
- if Res = OSI.False then
+ if Res = Win32.FALSE then
raise Lock_Error;
end if;
end Release_Lock;