diff options
author | Jose Ruiz <ruiz@adacore.com> | 2006-02-17 17:06:01 +0100 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2006-02-17 17:06:01 +0100 |
commit | 72774950676b37f320c6cd60ff1789da1106f3dd (patch) | |
tree | 024e166c7349145b0d2523ffd817d9715eabc00a /gcc/ada/s-taprop-vxworks.adb | |
parent | aea625ddaee76c08abeb3d1eccd7bcd63dc455de (diff) | |
download | gcc-72774950676b37f320c6cd60ff1789da1106f3dd.tar.gz |
s-taprop-irix.adb, [...] (Set_False, [...]): Add Abort_Defer/Undefer pairs to avoid the possibility of a task being aborted...
2006-02-17 Jose Ruiz <ruiz@adacore.com>
* s-taprop-irix.adb, s-taprop-hpux-dce.adb, s-taprop-linux.adb,
s-taprop-solaris.adb, s-taprop-vms.adb, s-taprop-mingw.adb,
s-taprop-posix.adb, s-taprop-vxworks.adb, s-taprop-lynxos.adb,
s-taprop-tru64.adb (Set_False, Set_True, Suspend_Until_True): Add
Abort_Defer/Undefer pairs to avoid the possibility of a task being
aborted while owning a lock.
From-SVN: r111184
Diffstat (limited to 'gcc/ada/s-taprop-vxworks.adb')
-rw-r--r-- | gcc/ada/s-taprop-vxworks.adb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/ada/s-taprop-vxworks.adb b/gcc/ada/s-taprop-vxworks.adb index 56a02dda238..186e8c28f40 100644 --- a/gcc/ada/s-taprop-vxworks.adb +++ b/gcc/ada/s-taprop-vxworks.adb @@ -51,11 +51,21 @@ with System.Interrupt_Management; with Interfaces.C; +with System.Soft_Links; +-- used for Abort_Defer/Undefer + +-- We use System.Soft_Links instead of System.Tasking.Initialization +-- because the later is a higher level package that we shouldn't depend on. +-- For example when using the restricted run time, it is replaced by +-- System.Tasking.Restricted.Stages. + with Unchecked_Conversion; with Unchecked_Deallocation; package body System.Task_Primitives.Operations is + package SSL renames System.Soft_Links; + use System.Tasking.Debug; use System.Tasking; use System.OS_Interface; @@ -1030,6 +1040,8 @@ package body System.Task_Primitives.Operations is procedure Set_False (S : in out Suspension_Object) is Result : STATUS; begin + SSL.Abort_Defer.all; + Result := semTake (S.L, WAIT_FOREVER); pragma Assert (Result = OK); @@ -1037,6 +1049,8 @@ package body System.Task_Primitives.Operations is Result := semGive (S.L); pragma Assert (Result = OK); + + SSL.Abort_Undefer.all; end Set_False; -------------- @@ -1046,6 +1060,8 @@ package body System.Task_Primitives.Operations is procedure Set_True (S : in out Suspension_Object) is Result : STATUS; begin + SSL.Abort_Defer.all; + Result := semTake (S.L, WAIT_FOREVER); pragma Assert (Result = OK); @@ -1066,6 +1082,8 @@ package body System.Task_Primitives.Operations is Result := semGive (S.L); pragma Assert (Result = OK); + + SSL.Abort_Undefer.all; end Set_True; ------------------------ @@ -1075,6 +1093,8 @@ package body System.Task_Primitives.Operations is procedure Suspend_Until_True (S : in out Suspension_Object) is Result : STATUS; begin + SSL.Abort_Defer.all; + Result := semTake (S.L, WAIT_FOREVER); if S.Waiting then @@ -1085,6 +1105,8 @@ package body System.Task_Primitives.Operations is Result := semGive (S.L); pragma Assert (Result = OK); + SSL.Abort_Undefer.all; + raise Program_Error; else -- Suspend the task if the state is False. Otherwise, the task @@ -1096,6 +1118,8 @@ package body System.Task_Primitives.Operations is Result := semGive (S.L); pragma Assert (Result = 0); + + SSL.Abort_Undefer.all; else S.Waiting := True; @@ -1104,6 +1128,8 @@ package body System.Task_Primitives.Operations is Result := semGive (S.L); pragma Assert (Result = OK); + SSL.Abort_Undefer.all; + Result := semTake (S.CV, WAIT_FOREVER); pragma Assert (Result = 0); end if; |