1 |
281 |
jeremybenn |
------------------------------------------------------------------------------
|
2 |
|
|
-- --
|
3 |
|
|
-- GNAT COMPILER COMPONENTS --
|
4 |
|
|
-- --
|
5 |
|
|
-- S Y S T E M . G L O B A L _ L O C K S --
|
6 |
|
|
-- --
|
7 |
|
|
-- S p e c --
|
8 |
|
|
-- --
|
9 |
|
|
-- Copyright (C) 1999-2009, Free Software Foundation, Inc. --
|
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 |
|
|
-- As a special exception under Section 7 of GPL version 3, you are granted --
|
19 |
|
|
-- additional permissions described in the GCC Runtime Library Exception, --
|
20 |
|
|
-- version 3.1, as published by the Free Software Foundation. --
|
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 |
|
|
-- GNAT was originally developed by the GNAT team at New York University. --
|
28 |
|
|
-- Extensive contributions were provided by Ada Core Technologies Inc. --
|
29 |
|
|
-- --
|
30 |
|
|
------------------------------------------------------------------------------
|
31 |
|
|
|
32 |
|
|
-- This package contains the necessary routines to provide
|
33 |
|
|
-- reliable system wide locking capability.
|
34 |
|
|
|
35 |
|
|
package System.Global_Locks is
|
36 |
|
|
|
37 |
|
|
Lock_Error : exception;
|
38 |
|
|
-- Exception raised if a request cannot be executed on a lock
|
39 |
|
|
|
40 |
|
|
type Lock_Type is private;
|
41 |
|
|
-- Such a lock is a global lock between partitions. This lock is
|
42 |
|
|
-- uniquely defined between the partitions because of its name.
|
43 |
|
|
|
44 |
|
|
Null_Lock : constant Lock_Type;
|
45 |
|
|
-- This needs comments ???
|
46 |
|
|
|
47 |
|
|
procedure Create_Lock (Lock : out Lock_Type; Name : String);
|
48 |
|
|
-- Create or retrieve a global lock for the current partition using
|
49 |
|
|
-- its Name.
|
50 |
|
|
|
51 |
|
|
procedure Acquire_Lock (Lock : in out Lock_Type);
|
52 |
|
|
-- If the lock cannot be acquired because someone already owns it, this
|
53 |
|
|
-- procedure is supposed to wait and retry forever.
|
54 |
|
|
|
55 |
|
|
procedure Release_Lock (Lock : in out Lock_Type);
|
56 |
|
|
|
57 |
|
|
private
|
58 |
|
|
|
59 |
|
|
type Lock_Type is new Natural;
|
60 |
|
|
|
61 |
|
|
Null_Lock : constant Lock_Type := 0;
|
62 |
|
|
|
63 |
|
|
end System.Global_Locks;
|