summaryrefslogtreecommitdiff
path: root/gcc/ada/s-taprop-solaris.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2006-02-17 16:06:01 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2006-02-17 16:06:01 +0000
commite0bfbf32fc83d556d3b5cd86ea33060fd0b68cb8 (patch)
tree024e166c7349145b0d2523ffd817d9715eabc00a /gcc/ada/s-taprop-solaris.adb
parente2dcd12e2156395d0d855100f8117a8be2eaa280 (diff)
downloadgcc-e0bfbf32fc83d556d3b5cd86ea33060fd0b68cb8.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@111184 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/s-taprop-solaris.adb')
-rw-r--r--gcc/ada/s-taprop-solaris.adb30
1 files changed, 27 insertions, 3 deletions
diff --git a/gcc/ada/s-taprop-solaris.adb b/gcc/ada/s-taprop-solaris.adb
index aa816b6746b..002064c66ab 100644
--- a/gcc/ada/s-taprop-solaris.adb
+++ b/gcc/ada/s-taprop-solaris.adb
@@ -64,10 +64,20 @@ with Interfaces.C;
with System.Task_Info;
-- to initialize Task_Info for a C thread, in function Self
+with System.Soft_Links;
+-- used for Defer/Undefer_Abort
+
+-- 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_Deallocation;
package body System.Task_Primitives.Operations is
+ package SSL renames System.Soft_Links;
+
use System.Tasking.Debug;
use System.Tasking;
use Interfaces.C;
@@ -1720,6 +1730,8 @@ package body System.Task_Primitives.Operations is
procedure Set_False (S : in out Suspension_Object) is
Result : Interfaces.C.int;
begin
+ SSL.Abort_Defer.all;
+
Result := mutex_lock (S.L'Access);
pragma Assert (Result = 0);
@@ -1727,6 +1739,8 @@ package body System.Task_Primitives.Operations is
Result := mutex_unlock (S.L'Access);
pragma Assert (Result = 0);
+
+ SSL.Abort_Undefer.all;
end Set_False;
--------------
@@ -1736,6 +1750,8 @@ package body System.Task_Primitives.Operations is
procedure Set_True (S : in out Suspension_Object) is
Result : Interfaces.C.int;
begin
+ SSL.Abort_Defer.all;
+
Result := mutex_lock (S.L'Access);
pragma Assert (Result = 0);
@@ -1756,6 +1772,8 @@ package body System.Task_Primitives.Operations is
Result := mutex_unlock (S.L'Access);
pragma Assert (Result = 0);
+
+ SSL.Abort_Undefer.all;
end Set_True;
------------------------
@@ -1765,6 +1783,8 @@ package body System.Task_Primitives.Operations is
procedure Suspend_Until_True (S : in out Suspension_Object) is
Result : Interfaces.C.int;
begin
+ SSL.Abort_Defer.all;
+
Result := mutex_lock (S.L'Access);
pragma Assert (Result = 0);
@@ -1776,6 +1796,8 @@ package body System.Task_Primitives.Operations is
Result := mutex_unlock (S.L'Access);
pragma Assert (Result = 0);
+ SSL.Abort_Undefer.all;
+
raise Program_Error;
else
-- Suspend the task if the state is False. Otherwise, the task
@@ -1788,10 +1810,12 @@ package body System.Task_Primitives.Operations is
S.Waiting := True;
Result := cond_wait (S.CV'Access, S.L'Access);
end if;
- end if;
- Result := mutex_unlock (S.L'Access);
- pragma Assert (Result = 0);
+ Result := mutex_unlock (S.L'Access);
+ pragma Assert (Result = 0);
+
+ SSL.Abort_Undefer.all;
+ end if;
end Suspend_Until_True;
----------------