
2011-08-31 Jose Ruiz <ruiz@adacore.com> * aspects.ads (Aspect_Id, Aspect_Argument, Aspect_Names): Add the dispatching domain aspect. * aspects.adb (Canonical_Aspect): Add entry for the dispatching domain aspect. * sem_ch13.adb (Analyze_Aspect_Specifications): Analyze the Dispatching_Domain aspect in a similar way as we do for the Priority aspect. * exp_ch9.adb (Expand_N_Task_Type_Declaration): Add the Dispatching_Domain component if a Dispatching_Domain pragma or aspect is present. (Make_Task_Create_Call): Add the Dispatching_Domain when creating a task * par-prag.adb (Prag): Add Pragma_Dispatching_Domain as a known pragma. * sem_prag.adb (Analyze_Pragma): Check the correctness of a pragma Dispatching_Domain and add it to the task definition. (Sig_Flags): Add Pragma_Dispatching_Domain. * rtsfind.ads, rtsfind.adb (RTU_Id, RE_Id, Get_Unit_Name): Add the support to find the types Dispatching_Domain and Dispatching_Domain_Access. * sinfo.ads, sinfo.adb (Has_Pragma_Dispatching_Domain, Set_Has_Pragma_Dispatching_Domain): Add these subprograms to set and query the availability of a pragma Dispatching_Domain. * snames.ads-tmpl (Name_uDispatching_Domain): Add this name required by the expander to pass the Dispatching_Domain when creating a task. (Name_Dispatching_Domain): Add this new name for a pragma. (Pragma_Id): Add the new Pragma_Dispatching_Domain. * s-tassta.ads, s-tassta.adb (Create_Task): Set the domain to which the task has been allocated at creation time. * s-tarest.adb (Create_Restricted_Task): The dispatching domain using Ravenscar is always null. * s-taskin.ads, s-taskin.adb (Initialize_ATCB): Set the domain to which the task has been allocated at creation time. * s-tporft.adb (Register_Foreign_Thread): A foreign task will not have a specific dispatching domain. * s-taprop-linux.adb, s-taprop-solaris.adb, s-taprop-vxworks.adb, s-taprop-mingw.adb (Create_Task): Check whether both Dispatching_Domain and CPU are specified for the task, and the CPU value is not contained within the range of processors for the domain. 2011-08-31 Vincent Celier <celier@adacore.com> * make.adb (Original_Gcc) : New constant String_Access. (Gnatmake): For VM targets, do not use VM version of the compiler if --GCC= has been specified. 2011-08-31 Thomas Quinot <quinot@adacore.com> * sem_ch5.adb: Minor reformatting. 2011-08-31 Ed Schonberg <schonberg@adacore.com> * exp_pakd.adb (Convert_To_PAT_Type): If prefix is a function call, do not reanalyze it. 2011-08-31 Bob Duff <duff@adacore.com> * exp_ch4.adb (Expand_N_Selected_Component): Use the full type, in case the access type is private; we don't care about privacy in expansion. 2011-08-31 Ed Schonberg <schonberg@adacore.com> * sem_aggr.adb (Resolve_Aggregate): In an instance, ignore aggregate subcomponents tnat may be limited, because they originate in view conflicts. If the original aggregate is legal and the actuals are legal, the aggregate itself is legal. From-SVN: r178371
109 lines
4.8 KiB
Ada
109 lines
4.8 KiB
Ada
------------------------------------------------------------------------------
|
|
-- --
|
|
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
|
|
-- --
|
|
-- SYSTEM.TASK_PRIMITIVES.OPERATIONS.REGISTER_FOREIGN_THREAD --
|
|
-- --
|
|
-- B o d y --
|
|
-- --
|
|
-- Copyright (C) 2002-2011, Free Software Foundation, Inc. --
|
|
-- --
|
|
-- GNARL is free software; you can redistribute it and/or modify it under --
|
|
-- terms of the GNU General Public License as published by the Free Soft- --
|
|
-- ware Foundation; either version 3, or (at your option) any later ver- --
|
|
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
|
|
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
|
|
-- or FITNESS FOR A PARTICULAR PURPOSE. --
|
|
-- --
|
|
-- As a special exception under Section 7 of GPL version 3, you are granted --
|
|
-- additional permissions described in the GCC Runtime Library Exception, --
|
|
-- version 3.1, as published by the Free Software Foundation. --
|
|
-- --
|
|
-- You should have received a copy of the GNU General Public License and --
|
|
-- a copy of the GCC Runtime Library Exception along with this program; --
|
|
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
|
|
-- <http://www.gnu.org/licenses/>. --
|
|
-- --
|
|
-- GNARL was developed by the GNARL team at Florida State University. --
|
|
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
|
|
-- --
|
|
------------------------------------------------------------------------------
|
|
|
|
with System.Task_Info;
|
|
-- Use for Unspecified_Task_Info
|
|
|
|
with System.Soft_Links;
|
|
-- used to initialize TSD for a C thread, in function Self
|
|
|
|
with System.Multiprocessors;
|
|
|
|
separate (System.Task_Primitives.Operations)
|
|
function Register_Foreign_Thread (Thread : Thread_Id) return Task_Id is
|
|
Local_ATCB : aliased Ada_Task_Control_Block (0);
|
|
Self_Id : Task_Id;
|
|
Succeeded : Boolean;
|
|
|
|
begin
|
|
-- This section is tricky. We must not call anything that might require
|
|
-- an ATCB, until the new ATCB is in place. In order to get an ATCB
|
|
-- immediately, we fake one, so that it is then possible to e.g allocate
|
|
-- memory (which might require accessing self).
|
|
|
|
-- Record this as the Task_Id for the thread
|
|
|
|
Local_ATCB.Common.LL.Thread := Thread;
|
|
Local_ATCB.Common.Current_Priority := System.Priority'First;
|
|
Specific.Set (Local_ATCB'Unchecked_Access);
|
|
|
|
-- It is now safe to use an allocator
|
|
|
|
Self_Id := new Ada_Task_Control_Block (0);
|
|
|
|
-- Finish initialization
|
|
|
|
Lock_RTS;
|
|
System.Tasking.Initialize_ATCB
|
|
(Self_Id, null, Null_Address, Null_Task,
|
|
Foreign_Task_Elaborated'Access,
|
|
System.Priority'First, System.Multiprocessors.Not_A_Specific_CPU, null,
|
|
Task_Info.Unspecified_Task_Info, 0, Self_Id, Succeeded);
|
|
Unlock_RTS;
|
|
pragma Assert (Succeeded);
|
|
|
|
Self_Id.Master_of_Task := 0;
|
|
Self_Id.Master_Within := Self_Id.Master_of_Task + 1;
|
|
|
|
for L in Self_Id.Entry_Calls'Range loop
|
|
Self_Id.Entry_Calls (L).Self := Self_Id;
|
|
Self_Id.Entry_Calls (L).Level := L;
|
|
end loop;
|
|
|
|
Self_Id.Common.State := Runnable;
|
|
Self_Id.Awake_Count := 1;
|
|
|
|
Self_Id.Common.Task_Image (1 .. 14) := "foreign thread";
|
|
Self_Id.Common.Task_Image_Len := 14;
|
|
|
|
-- Since this is not an ordinary Ada task, we will start out undeferred
|
|
|
|
Self_Id.Deferral_Level := 0;
|
|
|
|
-- We do not provide an alternate stack for foreign threads
|
|
|
|
Self_Id.Common.Task_Alternate_Stack := Null_Address;
|
|
|
|
System.Soft_Links.Create_TSD (Self_Id.Common.Compiler_Data);
|
|
|
|
-- ???
|
|
-- The following call is commented out to avoid dependence on the
|
|
-- System.Tasking.Initialization package. It seems that if we want
|
|
-- Ada.Task_Attributes to work correctly for C threads we will need to
|
|
-- raise the visibility of this soft link to System.Soft_Links. We are
|
|
-- putting that off until this new functionality is otherwise stable.
|
|
|
|
-- System.Tasking.Initialization.Initialize_Attributes_Link.all (T);
|
|
|
|
Enter_Task (Self_Id);
|
|
|
|
return Self_Id;
|
|
end Register_Foreign_Thread;
|