diff options
author | Ronan Desplanques <desplanques@adacore.com> | 2024-04-15 18:07:49 +0200 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2024-06-10 11:03:59 +0200 |
commit | aec9d8c9f5d673ff745f7b0560966e98b1404a53 (patch) | |
tree | 4e16cf54e3be659715045da5eda39586c022362f /gcc | |
parent | e12e69b1f5b0e966200b6c9b9bf73e624d62add7 (diff) | |
download | gcc-aec9d8c9f5d673ff745f7b0560966e98b1404a53.zip gcc-aec9d8c9f5d673ff745f7b0560966e98b1404a53.tar.gz gcc-aec9d8c9f5d673ff745f7b0560966e98b1404a53.tar.bz2 |
ada: Fix usage of SetThreadIdealProcessor
This patches fixes the way the run-time library checks the return
value of SetThreadIdealProcessor.
gcc/ada/
* libgnarl/s-taprop__mingw.adb (Set_Task_Affinity): Fix usage
of SetThreadIdealProcessor.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/libgnarl/s-taprop__mingw.adb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc/ada/libgnarl/s-taprop__mingw.adb b/gcc/ada/libgnarl/s-taprop__mingw.adb index 3a124ba..38e281c 100644 --- a/gcc/ada/libgnarl/s-taprop__mingw.adb +++ b/gcc/ada/libgnarl/s-taprop__mingw.adb @@ -1308,7 +1308,13 @@ package body System.Task_Primitives.Operations is Result := SetThreadIdealProcessor (T.Common.LL.Thread, ProcessorId (T.Common.Base_CPU) - 1); - pragma Assert (Result = 1); + + -- The documentation for SetThreadIdealProcessor states: + -- + -- If the function fails, the return value is (DWORD) - 1. + -- + -- That should map to DWORD'Last in Ada. + pragma Assert (Result /= DWORD'Last); -- Task_Info @@ -1317,7 +1323,10 @@ package body System.Task_Primitives.Operations is Result := SetThreadIdealProcessor (T.Common.LL.Thread, T.Common.Task_Info.CPU); - pragma Assert (Result = 1); + + -- See the comment above about the return value of + -- SetThreadIdealProcessor. + pragma Assert (Result /= DWORD'Last); end if; -- Dispatching domains |