summaryrefslogtreecommitdiff
path: root/gcc/ada/s-tassta.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2011-09-01 10:36:43 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2011-09-01 10:36:43 +0000
commitcb4c311d84a0eb2e972da8553fb700570a6b4108 (patch)
treec14fd51fc3ca9f529580faf85a8e07628662b3cb /gcc/ada/s-tassta.adb
parentf9e0c415043f24d2d50272f6fd520e21fdc1eaf6 (diff)
downloadgcc-cb4c311d84a0eb2e972da8553fb700570a6b4108.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@178400 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/s-tassta.adb')
-rw-r--r--gcc/ada/s-tassta.adb36
1 files changed, 32 insertions, 4 deletions
diff --git a/gcc/ada/s-tassta.adb b/gcc/ada/s-tassta.adb
index 994b3958757..3711ce30d8b 100644
--- a/gcc/ada/s-tassta.adb
+++ b/gcc/ada/s-tassta.adb
@@ -493,6 +493,8 @@ package body System.Tasking.Stages is
Len : Natural;
Base_CPU : System.Multiprocessors.CPU_Range;
+ use type System.Multiprocessors.CPU_Range;
+
pragma Unreferenced (Relative_Deadline);
-- EDF scheduling is not supported by any of the target platforms so
-- this parameter is not passed any further.
@@ -540,10 +542,6 @@ package body System.Tasking.Stages is
else System.Multiprocessors.CPU_Range (CPU));
end if;
- -- ??? If we want to handle the interaction between pragma CPU and
- -- dispatching domains we would need to signal that this task is being
- -- allocated to a processor.
-
-- Find parent P of new Task, via master level number
P := Self_ID;
@@ -658,6 +656,36 @@ package body System.Tasking.Stages is
Unlock (Self_ID);
Unlock_RTS;
+ -- The CPU associated to the task (if any) must belong to the
+ -- dispatching domain.
+
+ if Base_CPU /= System.Multiprocessors.Not_A_Specific_CPU and then
+ (Base_CPU not in T.Common.Domain'Range
+ or else not T.Common.Domain (Base_CPU))
+ then
+ Initialization.Undefer_Abort_Nestable (Self_ID);
+ raise Tasking_Error with "CPU not in dispatching domain";
+ end if;
+
+ -- In order to handle the interaction between pragma CPU and
+ -- dispatching domains we need to signal that this task is being
+ -- allocated to a processor. This is needed only for tasks belonging to
+ -- the system domain (the creation of new dispatching domains can only
+ -- take processors from the system domain) and only before the
+ -- environment task calls the main procedure (dispatching domains cannot
+ -- be created after this).
+
+ if Base_CPU /= System.Multiprocessors.Not_A_Specific_CPU
+ and then T.Common.Domain = System.Tasking.System_Domain
+ and then not System.Tasking.Dispatching_Domains_Frozen
+ then
+ -- Increase the number of tasks attached to the CPU to which this
+ -- task is being moved.
+
+ Dispatching_Domain_Tasks (Base_CPU) :=
+ Dispatching_Domain_Tasks (Base_CPU) + 1;
+ end if;
+
-- Note: we should not call 'new' while holding locks since new
-- may use locks (e.g. RTS_Lock under Windows) itself and cause a
-- deadlock.