OSDN Git Service

* c-decl.c (grokfield): Allow typedefs for anonymous structs and
[pf3gnuchains/gcc-fork.git] / gcc / ada / g-locfil.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                      G N A T . L O C K _ F I L E S                       --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --                     Copyright (C) 1995-2008, 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 2,  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.  See the GNU General Public License --
17 -- for  more details.  You should have  received  a copy of the GNU General --
18 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
19 -- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
20 -- Boston, MA 02110-1301, USA.                                              --
21 --                                                                          --
22 -- As a special exception,  if other files  instantiate  generics from this --
23 -- unit, or you link  this unit with other files  to produce an executable, --
24 -- this  unit  does not  by itself cause  the resulting  executable  to  be --
25 -- covered  by the  GNU  General  Public  License.  This exception does not --
26 -- however invalidate  any other reasons why  the executable file  might be --
27 -- covered by the  GNU Public License.                                      --
28 --                                                                          --
29 -- GNAT was originally developed  by the GNAT team at  New York University. --
30 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
31 --                                                                          --
32 ------------------------------------------------------------------------------
33
34 --  This package contains the necessary routines for using files for the
35 --  purpose of providing reliable system wide locking capability.
36
37 package GNAT.Lock_Files is
38    pragma Preelaborate;
39
40    Lock_Error : exception;
41    --  Exception raised if file cannot be locked
42
43    subtype Path_Name is String;
44    --  Pathname is used by all services provided in this unit to specified
45    --  directory name and file name. On DOS based systems both directory
46    --  separators are handled (i.e. slash and backslash).
47
48    procedure Lock_File
49      (Directory      : Path_Name;
50       Lock_File_Name : Path_Name;
51       Wait           : Duration := 1.0;
52       Retries        : Natural  := Natural'Last);
53    --  Create a lock file Lock_File_Name in directory Directory. If the file
54    --  cannot be locked because someone already owns the lock, this procedure
55    --  waits Wait seconds and retries at most Retries times. If the file
56    --  still cannot be locked, Lock_Error is raised. The default is to try
57    --  every second, almost forever (Natural'Last times). The full path of
58    --  the file is constructed by concatenating Directory and Lock_File_Name.
59    --  Directory can optionally terminate with a directory separator.
60
61    procedure Lock_File
62      (Lock_File_Name : Path_Name;
63       Wait           : Duration := 1.0;
64       Retries        : Natural  := Natural'Last);
65    --  See above. The full lock file path is given as one string
66
67    procedure Unlock_File (Directory : Path_Name; Lock_File_Name : Path_Name);
68    --  Unlock a file. Directory can optionally terminate with a directory
69    --  separator.
70
71    procedure Unlock_File (Lock_File_Name : Path_Name);
72    --  Unlock a file whose full path is given in Lock_File_Name
73
74 end GNAT.Lock_Files;