summaryrefslogtreecommitdiff
path: root/gcc/ada/g-tasloc.ads
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/g-tasloc.ads')
-rw-r--r--gcc/ada/g-tasloc.ads19
1 files changed, 11 insertions, 8 deletions
diff --git a/gcc/ada/g-tasloc.ads b/gcc/ada/g-tasloc.ads
index 7b09d45d5d5..f2090b5ceb5 100644
--- a/gcc/ada/g-tasloc.ads
+++ b/gcc/ada/g-tasloc.ads
@@ -6,8 +6,7 @@
-- --
-- S p e c --
-- --
--- --
--- Copyright (C) 1998-2001 Ada Core Technologies, Inc. --
+-- Copyright (C) 1998-2002 Ada Core Technologies, 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- --
@@ -53,10 +52,10 @@ pragma Elaborate_Body (Task_Lock);
pragma Inline (Unlock);
-- Releases the global lock, allowing another task to successfully
-- complete a Lock operation. Terminates the critical region.
-
+ --
-- The recommended protocol for using these two procedures is as
-- follows:
-
+ --
-- Locked_Processing : begin
-- Lock;
-- ...
@@ -67,26 +66,30 @@ pragma Elaborate_Body (Task_Lock);
-- Unlock;
-- raise;
-- end Locked_Processing;
-
+ --
-- This ensures that the lock is not left set if an exception is raised
-- explicitly or implicitly during the critical locked region.
-
+ --
-- Note on multiple calls to Lock: It is permissible to call Lock
-- more than once with no intervening Unlock from a single task,
-- and the lock will not be released until the corresponding number
-- of Unlock operations has been performed. For example:
-
+ --
-- GNAT.Task_Lock.Lock; -- acquires lock
-- GNAT.Task_Lock.Lock; -- no effect
-- GNAT.Task_Lock.Lock; -- no effect
-- GNAT.Task_Lock.Unlock; -- no effect
-- GNAT.Task_Lock.Unlock; -- no effect
-- GNAT.Task_Lock.Unlock; -- releases lock
-
+ --
-- However, as previously noted, the Task_Lock facility should only
-- be used for very local locks where the probability of conflict is
-- low, so usually this kind of nesting is not a good idea in any case.
-- In more complex locking situations, it is more appropriate to define
-- an appropriate protected type to provide the required locking.
+ --
+ -- It is an error to call Unlock when there has been no prior call to
+ -- Lock. The effect of such an erroneous call is undefined, and may
+ -- result in deadlock, or other malfunction of the run-time system.
end GNAT.Task_Lock;