diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2011-09-01 15:29:39 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2011-09-01 15:29:39 +0200 |
commit | 6b81741c0717e0322b61591a655dc83265f84ea8 (patch) | |
tree | 19bd4ae775641dbfbeb38572123fbb8a6e99ec38 /gcc/ada/s-taprop-linux.adb | |
parent | 8256c1bfeb880b42c2ce9744fa1905b4d225d792 (diff) | |
download | gcc-6b81741c0717e0322b61591a655dc83265f84ea8.zip gcc-6b81741c0717e0322b61591a655dc83265f84ea8.tar.gz gcc-6b81741c0717e0322b61591a655dc83265f84ea8.tar.bz2 |
[multiple changes]
2011-09-01 Jose Ruiz <ruiz@adacore.com>
* s-taprop-linux.adb (Create_Task, Set_Task_Affinity): Use the linux
macros for handling CPU sets (CPU_ZERO, CPU_SET) instead of modifying
directly the bit array.
* s-osinte-linux.ads (CPU_ZERO, CPU_SET): Import these wrappers around
the linux macros with the same name.
* adaint.h, adaint.c (__gnat_cpu_zero, __gnat_cpu_set): Create these
wrappers around the CPU_ZERO and CPU_SET linux macros.
2011-09-01 Hristian Kirtchev <kirtchev@adacore.com>
* exp_ch7.adb (Find_Insertion_List): Removed.
(Process_Transient_Objects): Insert the declarations of the hook
access type and the hook object before the associated transient object.
2011-09-01 Jose Ruiz <ruiz@adacore.com>
* sem_ch8.adb (Attribute_Renaming): Add missing check to avoid loading
package System.Aux_Dec when using restricted run-time libraries which
do not have this package.
2011-09-01 Tristan Gingold <gingold@adacore.com>
* s-vaflop-vms-alpha.adb: Remove pragma optimize, useless.
2011-09-01 Bob Duff <duff@adacore.com>
* sem_attr.adb (Analyze_Access_Attribute): Do not call
Kill_Current_Values for P'Unrestricted_Access, where P is library level
2011-09-01 Thomas Quinot <quinot@adacore.com>
* exp_ch5.adb: Minor reformatting
* gnat_ugn.texi: Fix minor typos.
* gcc-interface/Make-lang.in: Update dependencies.
From-SVN: r178414
Diffstat (limited to 'gcc/ada/s-taprop-linux.adb')
-rw-r--r-- | gcc/ada/s-taprop-linux.adb | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/gcc/ada/s-taprop-linux.adb b/gcc/ada/s-taprop-linux.adb index a8f1568..eced89a 100644 --- a/gcc/ada/s-taprop-linux.adb +++ b/gcc/ada/s-taprop-linux.adb @@ -869,9 +869,12 @@ package body System.Task_Primitives.Operations is elsif T.Common.Base_CPU /= System.Multiprocessors.Not_A_Specific_CPU then declare - CPU_Set : aliased cpu_set_t := (bits => (others => False)); + CPU_Set : aliased cpu_set_t; + begin - CPU_Set.bits (Integer (T.Common.Base_CPU)) := True; + System.OS_Interface.CPU_ZERO (CPU_Set'Access); + System.OS_Interface.CPU_SET + (int (T.Common.Base_CPU), CPU_Set'Access); Result := pthread_attr_setaffinity_np (Attributes'Access, @@ -905,14 +908,18 @@ package body System.Task_Primitives.Operations is Multiprocessors.Number_Of_CPUs => True)) then declare - CPU_Set : aliased cpu_set_t := (bits => (others => False)); + CPU_Set : aliased cpu_set_t; begin + System.OS_Interface.CPU_ZERO (CPU_Set'Access); + -- Set the affinity to all the processors belonging to the -- dispatching domain. for Proc in T.Common.Domain'Range loop - CPU_Set.bits (Integer (Proc)) := T.Common.Domain (Proc); + if T.Common.Domain (Proc) then + System.OS_Interface.CPU_SET (int (Proc), CPU_Set'Access); + end if; end loop; Result := @@ -1394,8 +1401,9 @@ package body System.Task_Primitives.Operations is then declare type cpu_set_t_ptr is access all cpu_set_t; + CPU_Set : aliased cpu_set_t; + CPU_Set_Ptr : cpu_set_t_ptr := null; - CPU_Set : cpu_set_t_ptr := null; Result : Interfaces.C.int; begin @@ -1406,16 +1414,17 @@ package body System.Task_Primitives.Operations is if T.Common.Base_CPU /= Multiprocessors.Not_A_Specific_CPU then -- Set the affinity to an unique CPU - - CPU_Set := new cpu_set_t'(bits => (others => False)); - CPU_Set.bits (Integer (T.Common.Base_CPU)) := True; + System.OS_Interface.CPU_ZERO (CPU_Set'Access); + System.OS_Interface.CPU_SET + (int (T.Common.Base_CPU), CPU_Set'Access); + CPU_Set_Ptr := CPU_Set'Access; -- Handle Task_Info elsif T.Common.Task_Info /= null and then T.Common.Task_Info.CPU_Affinity /= Task_Info.Any_CPU then - CPU_Set := T.Common.Task_Info.CPU_Affinity'Access; + CPU_Set_Ptr := T.Common.Task_Info.CPU_Affinity'Access; -- Handle dispatching domains @@ -1431,11 +1440,13 @@ package body System.Task_Primitives.Operations is -- domain other than the default one, or when the default one -- has been modified. - CPU_Set := new cpu_set_t'(bits => (others => False)); + System.OS_Interface.CPU_ZERO (CPU_Set'Access); for Proc in T.Common.Domain'Range loop - CPU_Set.bits (Integer (Proc)) := T.Common.Domain (Proc); + System.OS_Interface.CPU_SET (int (Proc), CPU_Set'Access); end loop; + + CPU_Set_Ptr := CPU_Set'Access; end if; -- We set the new affinity if needed. Otherwise, the new task @@ -1443,10 +1454,10 @@ package body System.Task_Primitives.Operations is -- the documentation of pthread_setaffinity_np), which is -- consistent with Ada's required semantics. - if CPU_Set /= null then + if CPU_Set_Ptr /= null then Result := pthread_setaffinity_np - (T.Common.LL.Thread, CPU_SETSIZE / 8, CPU_Set); + (T.Common.LL.Thread, CPU_SETSIZE / 8, CPU_Set_Ptr); pragma Assert (Result = 0); end if; end; |