pragma Thread_Body ( [Entity =>] local_NAME, [[Secondary_Stack_Size =>] static_integer_EXPRESSION)];
This pragma specifies that the subprogram whose name is given as the
Entity argument is a thread body, which will be activated
by being called via its Address from foreign code. The purpose is
to allow execution and registration of the foreign thread within the
Ada run-time system.
See the library unit
System.Threads for details on the expansion of
a thread body subprogram, including the calls made to subprograms
within System.Threads to register the task. This unit also lists the
targets and runtime systems for which this pragma is supported.
A thread body subprogram may not be called directly from Ada code, and it is not permitted to apply the Access (or Unrestricted_Access) attributes to such a subprogram. The only legitimate way of calling such a subprogram is to pass its Address to foreign code and then make the call from the foreign code.
A thread body subprogram may have any parameters, and it may be a function
returning a result. The convention of the thread body subprogram may be
set in the usual manner using
The secondary stack size parameter, if given, is used to set the size
of secondary stack for the thread. The secondary stack is allocated as
a local variable of the expanded thread body subprogram, and thus is
allocated out of the main thread stack size. If no secondary stack
size parameter is present, the default size (from the declaration in
System.Secondary_Stack is used.