diff options
author | Steve Baird <baird@adacore.com> | 2021-05-14 15:03:02 -0700 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2021-07-07 16:23:10 +0000 |
commit | 0dbe0e11eb75e52885a0f6894a8d3da770f87ca0 (patch) | |
tree | 98c1732afdb123d9537437881185df3f77b62502 /gcc | |
parent | 06357071d0557c4f0e9b0a6dfc4d37f5680e34cc (diff) | |
download | gcc-0dbe0e11eb75e52885a0f6894a8d3da770f87ca0.zip gcc-0dbe0e11eb75e52885a0f6894a8d3da770f87ca0.tar.gz gcc-0dbe0e11eb75e52885a0f6894a8d3da770f87ca0.tar.bz2 |
[Ada] Unsynchronized access to a Boolean in tasking state
gcc/ada/
* libgnarl/s-tassta.adb (Free_Task): Acquire the Task_Lock
before, rather than after, querying the task's Terminated flag.
Add a corresponding Task_Unlock call.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/libgnarl/s-tassta.adb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/ada/libgnarl/s-tassta.adb b/gcc/ada/libgnarl/s-tassta.adb index f18c76f..88850c2 100644 --- a/gcc/ada/libgnarl/s-tassta.adb +++ b/gcc/ada/libgnarl/s-tassta.adb @@ -910,12 +910,12 @@ package body System.Tasking.Stages is Self_Id : constant Task_Id := Self; begin + Initialization.Task_Lock (Self_Id); + if T.Common.State = Terminated then -- It is not safe to call Abort_Defer or Write_Lock at this stage - Initialization.Task_Lock (Self_Id); - Lock_RTS; Initialization.Finalize_Attributes (T); Initialization.Remove_From_All_Tasks_List (T); @@ -930,6 +930,7 @@ package body System.Tasking.Stages is -- upon termination. T.Free_On_Termination := True; + Initialization.Task_Unlock (Self_Id); end if; end Free_Task; |