diff options
Diffstat (limited to 'gcc/ada/g-tasloc.ads')
-rw-r--r-- | gcc/ada/g-tasloc.ads | 56 |
1 files changed, 4 insertions, 52 deletions
diff --git a/gcc/ada/g-tasloc.ads b/gcc/ada/g-tasloc.ads index 757d3c2df93..ce49667c8b1 100644 --- a/gcc/ada/g-tasloc.ads +++ b/gcc/ada/g-tasloc.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1998-2005, AdaCore -- +-- Copyright (C) 1998-2007, 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- -- @@ -41,56 +41,8 @@ -- These routines may be used in a non-tasking program, and in that case -- they have no effect (they do NOT cause the tasking runtime to be loaded). -package GNAT.Task_Lock is - pragma Elaborate_Body; +-- See file s-tasloc.ads for full documentation of the interface - procedure Lock; - pragma Inline (Lock); - -- Acquires the global lock, starts the execution of a critical region - -- which no other task can enter until the locking task calls Unlock +with System.Task_Lock; - procedure Unlock; - 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; - -- ... - -- TSL.Unlock; - -- - -- exception - -- when others => - -- 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; +package GNAT.Task_Lock renames System.Task_Lock; |