aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/s-mudido-affinity.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2011-09-01 12:36:43 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2011-09-01 12:36:43 +0200
commit516f608f15dcef7a20a2e178c57e3e8078784331 (patch)
treec14fd51fc3ca9f529580faf85a8e07628662b3cb /gcc/ada/s-mudido-affinity.adb
parent2d42e8812ef4954cd42ac861090c16ac27c3ac7e (diff)
downloadgcc-516f608f15dcef7a20a2e178c57e3e8078784331.zip
gcc-516f608f15dcef7a20a2e178c57e3e8078784331.tar.gz
gcc-516f608f15dcef7a20a2e178c57e3e8078784331.tar.bz2
[multiple changes]
2011-09-01 Robert Dewar <dewar@adacore.com> * a-cbprqu.adb, a-cbprqu.ads, a-cuprqu.adb, a-cuprqu.ads, a-cbsyqu.adb, a-cbsyqu.ads: Minor reformatting. 2011-09-01 Ed Schonberg <schonberg@adacore.com> * sem_attr.adb: Conditionalize aliasing predicates to Ada2012. 2011-09-01 Jose Ruiz <ruiz@adacore.com> * aspects.ads (Aspect_Id, Aspect_Argument, Aspect_Names): Add the CPU aspect. * aspects.adb (Canonical_Aspect): Add entry for the CPU aspect. * sem_ch13.adb (Analyze_Aspect_Specifications): Analyze the CPU aspect in a similar way as we do for the Priority or Dispatching_Domain aspect. * s-mudido-affinity.adb (Dispatching_Domain_Tasks, Dispatching_Domains_Frozen): Move this local data to package System.Tasking because with the CPU aspect we need to have access to this data when creating the task in System.Tasking.Stages.Create_Task * s-taskin.ads (Dispatching_Domain_Tasks, Dispatching_Domains_Frozen): Move these variables from the body of System.Multiprocessors.Dispatching_Domains because with the CPU aspect we need to have access to this data when creating the task in System.Tasking.Stages.Create_Task. * s-taskin.adb (Initialize): Signal the allocation of the environment task to a CPU, if any, so that we know whether the CPU can be transferred to a different dispatching domain. * s-tassta.adb (Create_Task): Check whether the CPU to which this task is being allocated belongs to the dispatching domain where the task lives. Signal the allocation of the task to a CPU, if any, so that we know whether the CPU can be transferred to a different dispatching domain. From-SVN: r178400
Diffstat (limited to 'gcc/ada/s-mudido-affinity.adb')
-rw-r--r--gcc/ada/s-mudido-affinity.adb32
1 files changed, 9 insertions, 23 deletions
diff --git a/gcc/ada/s-mudido-affinity.adb b/gcc/ada/s-mudido-affinity.adb
index c72dc39..35239b8 100644
--- a/gcc/ada/s-mudido-affinity.adb
+++ b/gcc/ada/s-mudido-affinity.adb
@@ -41,21 +41,6 @@ package body System.Multiprocessors.Dispatching_Domains is
package ST renames System.Tasking;
- ----------------
- -- Local data --
- ----------------
-
- Dispatching_Domain_Tasks : array (CPU'First .. Number_Of_CPUs) of Natural :=
- (others => 0);
- -- We need to store whether there are tasks allocated to concrete
- -- processors in the default system dispatching domain because we need to
- -- check it before creating a new dispatching domain.
- -- ??? Tasks allocated with pragma CPU are not taken into account here.
-
- Dispatching_Domains_Frozen : Boolean := False;
- -- True when the main procedure has been called. Hence, no new dispatching
- -- domains can be created when this flag is True.
-
-----------------------
-- Local subprograms --
-----------------------
@@ -132,6 +117,7 @@ package body System.Multiprocessors.Dispatching_Domains is
function Create (First, Last : CPU) return Dispatching_Domain is
use type System.Tasking.Dispatching_Domain;
use type System.Tasking.Dispatching_Domain_Access;
+ use type System.Tasking.Array_Allocated_Tasks;
use type System.Tasking.Task_Id;
Valid_System_Domain : constant Boolean :=
@@ -177,7 +163,7 @@ package body System.Multiprocessors.Dispatching_Domains is
"CPU range not currently in System_Dispatching_Domain";
elsif
- Dispatching_Domain_Tasks (First .. Last) /= (First .. Last => 0)
+ ST.Dispatching_Domain_Tasks (First .. Last) /= (First .. Last => 0)
then
raise Dispatching_Domain_Error with "CPU range has tasks assigned";
@@ -189,7 +175,7 @@ package body System.Multiprocessors.Dispatching_Domains is
raise Dispatching_Domain_Error with
"only the environment task can create dispatching domains";
- elsif Dispatching_Domains_Frozen then
+ elsif ST.Dispatching_Domains_Frozen then
raise Dispatching_Domain_Error with
"cannot create dispatching domain after call to main program";
end if;
@@ -253,7 +239,7 @@ package body System.Multiprocessors.Dispatching_Domains is
begin
-- Signal the end of the elaboration code
- Dispatching_Domains_Frozen := True;
+ ST.Dispatching_Domains_Frozen := True;
end Freeze_Dispatching_Domains;
-------------
@@ -370,23 +356,23 @@ package body System.Multiprocessors.Dispatching_Domains is
-- Change the number of tasks attached to a given task in the system
-- domain if needed.
- if not Dispatching_Domains_Frozen
+ if not ST.Dispatching_Domains_Frozen
and then (Domain = null or else Domain = ST.System_Domain)
then
-- Reduce the number of tasks attached to the CPU from which this
-- task is being moved, if needed.
if Source_CPU /= Not_A_Specific_CPU then
- Dispatching_Domain_Tasks (Source_CPU) :=
- Dispatching_Domain_Tasks (Source_CPU) - 1;
+ ST.Dispatching_Domain_Tasks (Source_CPU) :=
+ ST.Dispatching_Domain_Tasks (Source_CPU) - 1;
end if;
-- Increase the number of tasks attached to the CPU to which this
-- task is being moved, if needed.
if CPU /= Not_A_Specific_CPU then
- Dispatching_Domain_Tasks (CPU) :=
- Dispatching_Domain_Tasks (CPU) + 1;
+ ST.Dispatching_Domain_Tasks (CPU) :=
+ ST.Dispatching_Domain_Tasks (CPU) + 1;
end if;
end if;