1------------------------------------------------------------------------------ 2-- -- 3-- GNAT COMPILER COMPONENTS -- 4-- -- 5-- S Y S T E M . T A S K _ I N F O -- 6-- -- 7-- S p e c -- 8-- -- 9-- Copyright (C) 2007-2019, Free Software Foundation, Inc. -- 10-- -- 11-- GNAT is free software; you can redistribute it and/or modify it under -- 12-- terms of the GNU General Public License as published by the Free Soft- -- 13-- ware Foundation; either version 3, or (at your option) any later ver- -- 14-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- 15-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- 16-- or FITNESS FOR A PARTICULAR PURPOSE. -- 17-- -- 18-- As a special exception under Section 7 of GPL version 3, you are granted -- 19-- additional permissions described in the GCC Runtime Library Exception, -- 20-- version 3.1, as published by the Free Software Foundation. -- 21-- -- 22-- You should have received a copy of the GNU General Public License and -- 23-- a copy of the GCC Runtime Library Exception along with this program; -- 24-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- 25-- <http://www.gnu.org/licenses/>. -- 26-- -- 27-- GNAT was originally developed by the GNAT team at New York University. -- 28-- Extensive contributions were provided by Ada Core Technologies Inc. -- 29-- -- 30------------------------------------------------------------------------------ 31 32-- This package contains the definitions and routines associated with the 33-- implementation and use of the Task_Info pragma. It is specialized 34-- appropriately for targets that make use of this pragma. 35 36-- Note: the compiler generates direct calls to this interface, via Rtsfind. 37-- Any changes to this interface may require corresponding compiler changes. 38 39-- The functionality in this unit is now provided by the predefined package 40-- System.Multiprocessors and the CPU aspect. This package is obsolescent. 41 42-- This is the GNU/Linux version of this module 43 44with System.OS_Interface; 45 46package System.Task_Info is 47 pragma Obsolescent (Task_Info, "use System.Multiprocessors and CPU aspect"); 48 pragma Preelaborate; 49 pragma Elaborate_Body; 50 -- To ensure that a body is allowed 51 52 -- The Linux kernel provides a way to define the ideal processor to use for 53 -- a given thread. The ideal processor is not necessarily the one that will 54 -- be used by the OS but the OS will always try to schedule this thread to 55 -- the specified processor if it is available. 56 57 -- The Task_Info pragma: 58 59 -- pragma Task_Info (EXPRESSION); 60 61 -- allows the specification on a task by task basis of a value of type 62 -- System.Task_Info.Task_Info_Type to be passed to a task when it is 63 -- created. The specification of this type, and the effect on the task 64 -- that is created is target dependent. 65 66 -- The Task_Info pragma appears within a task definition (compare the 67 -- definition and implementation of pragma Priority). If no such pragma 68 -- appears, then the value Unspecified_Task_Info is passed. If a pragma 69 -- is present, then it supplies an alternative value. If the argument of 70 -- the pragma is a discriminant reference, then the value can be set on 71 -- a task by task basis by supplying the appropriate discriminant value. 72 73 -- Note that this means that the type used for Task_Info_Type must be 74 -- suitable for use as a discriminant (i.e. a scalar or access type). 75 76 ----------------------- 77 -- Thread Attributes -- 78 ----------------------- 79 80 subtype CPU_Set is System.OS_Interface.cpu_set_t; 81 82 Any_CPU : constant CPU_Set := (bits => (others => True)); 83 No_CPU : constant CPU_Set := (bits => (others => False)); 84 85 Invalid_CPU_Number : exception; 86 -- Raised when an invalid CPU mask has been specified 87 -- i.e. An empty CPU set 88 89 type Thread_Attributes is record 90 CPU_Affinity : aliased CPU_Set := Any_CPU; 91 end record; 92 93 Default_Thread_Attributes : constant Thread_Attributes := (others => <>); 94 95 type Task_Info_Type is access all Thread_Attributes; 96 97 Unspecified_Task_Info : constant Task_Info_Type := null; 98 99 function Number_Of_Processors return Positive; 100 -- Returns the number of processors on the running host 101 102end System.Task_Info; 103