aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/libgnarl
diff options
context:
space:
mode:
authorRonan Desplanques <desplanques@adacore.com>2024-04-02 09:09:31 +0200
committerMarc Poulhiès <poulhies@adacore.com>2024-05-21 09:26:47 +0200
commit0cb4e7f41b6466718715ea71fce6621c9e93ecfd (patch)
treef23710189e9735dc9d18088c363f1d915ef22f82 /gcc/ada/libgnarl
parent238fba24a43280e692fc9c53852657837bbc94bc (diff)
downloadgcc-0cb4e7f41b6466718715ea71fce6621c9e93ecfd.zip
gcc-0cb4e7f41b6466718715ea71fce6621c9e93ecfd.tar.gz
gcc-0cb4e7f41b6466718715ea71fce6621c9e93ecfd.tar.bz2
ada: Remove some explicit yields in tasking run-time
This patch removes three occurrences where tasking run-time subprograms yielded control shortly before conditional calls to Sleep, in order to avoid these calls more often. It was intended as an optimization on systems where calls to Sleep are costly and in particular VMS. A problem was that two of the yields contained data races that were reported by thread sanitizing tools on some platforms, and that's the motivation for removing them. gcc/ada/ * libgnarl/s-taenca.adb (Wait_For_Completion): Remove call to Yield. * libgnarl/s-tasren.adb (Timed_Selective_Wait, Wait_For_Call): Remove calls to Yield.
Diffstat (limited to 'gcc/ada/libgnarl')
-rw-r--r--gcc/ada/libgnarl/s-taenca.adb12
-rw-r--r--gcc/ada/libgnarl/s-tasren.adb24
2 files changed, 0 insertions, 36 deletions
diff --git a/gcc/ada/libgnarl/s-taenca.adb b/gcc/ada/libgnarl/s-taenca.adb
index cd9c53b..1dc8ec5 100644
--- a/gcc/ada/libgnarl/s-taenca.adb
+++ b/gcc/ada/libgnarl/s-taenca.adb
@@ -410,18 +410,6 @@ package body System.Tasking.Entry_Calls is
Self_Id.Common.State := Entry_Caller_Sleep;
- -- Try to remove calls to Sleep in the loop below by letting the caller
- -- a chance of getting ready immediately, using Unlock & Yield.
- -- See similar action in Wait_For_Call & Timed_Selective_Wait.
-
- STPO.Unlock (Self_Id);
-
- if Entry_Call.State < Done then
- STPO.Yield;
- end if;
-
- STPO.Write_Lock (Self_Id);
-
loop
Check_Pending_Actions_For_Entry_Call (Self_Id, Entry_Call);
diff --git a/gcc/ada/libgnarl/s-tasren.adb b/gcc/ada/libgnarl/s-tasren.adb
index d65b9f0..6face7e 100644
--- a/gcc/ada/libgnarl/s-tasren.adb
+++ b/gcc/ada/libgnarl/s-tasren.adb
@@ -1317,18 +1317,6 @@ package body System.Tasking.Rendezvous is
Self_Id.Common.State := Acceptor_Delay_Sleep;
- -- Try to remove calls to Sleep in the loop below by letting the
- -- caller a chance of getting ready immediately, using Unlock
- -- Yield. See similar action in Wait_For_Completion/Wait_For_Call.
-
- Unlock (Self_Id);
-
- if Self_Id.Open_Accepts /= null then
- Yield;
- end if;
-
- Write_Lock (Self_Id);
-
-- Check if this task has been aborted while the lock was released
if Self_Id.Pending_ATC_Level < Self_Id.ATC_Nesting_Level then
@@ -1510,18 +1498,6 @@ package body System.Tasking.Rendezvous is
begin
Self_Id.Common.State := Acceptor_Sleep;
- -- Try to remove calls to Sleep in the loop below by letting the caller
- -- a chance of getting ready immediately, using Unlock & Yield.
- -- See similar action in Wait_For_Completion & Timed_Selective_Wait.
-
- Unlock (Self_Id);
-
- if Self_Id.Open_Accepts /= null then
- Yield;
- end if;
-
- Write_Lock (Self_Id);
-
-- Check if this task has been aborted while the lock was released
if Self_Id.Pending_ATC_Level < Self_Id.ATC_Nesting_Level then