File : s-sssita-xi.ads
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S Y S T E M . S E C O N D A R Y _ S T A C K . S I N G L E _ T A S K --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2005-2014, 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 -- --
19 -- --
20 -- --
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 provides a default and simple implementation of a function
33 -- that returns a pointer to a secondary stack. This function is intended
34 -- to be used on single-threaded applications. Multi-threaded applications
35 -- require thread-local data.
36 --
37 -- The function defined in this package is used when the two following
38 -- conditions are met:
39 -- 1) No user-defined implementation has been provided. That is, the
40 -- symbol __gnat_get_sec_stack is not exported by the user's code.
41 -- 2) No tasking is used. When tasking is used, the __gnat_get_sec_stack
42 -- reference is resolved by libgnarl.a (that contains a thread-safe
43 -- implementation of the secondary stack), so that the single-threaded
44 -- version is not included in the final executable.
45 --
46 -- Note that the problem of providing different implementations for tasking
47 -- and not tasking applications is usually solved by using the
48 -- System.Soft_Links mechanism. This approach has not been followed because
49 -- this mechanism if it not available for the High Integrity Ravenscar run
50 -- times.
51 --
52 -- Another possibility would be to always use the tasking (multi-threaded)
53 -- version of this function. However, it forces a dependency on libgnarl in
54 -- libgnat, which is not desirable.
55
56 pragma Restrictions (No_Elaboration_Code);
57 -- We want to guarantee the absence of elaboration code because the
58 -- binder does not handle references to this package.
59
60 package System.Secondary_Stack.Single_Task is
61
62 function Get_Sec_Stack return Address;
63 pragma Export (C, Get_Sec_Stack, "__gnat_get_secondary_stack");
64 -- Return the address of the secondary stack to be used for
65 -- single-threaded applications, as expected by
66 -- System.Secondary_Stack.
67
68 end System.Secondary_Stack.Single_Task;