User-Level Native Thread Primitives (GThread) Library White Paper (G06.27+, H06.03+, J06.03+)

User-Level Native Thread Primitives (GThread Library) 02/15/2012
540065-004 Page 15 of 44
MainCB - The address of the main thread control block that designates the initial processing
environment, as established by GTHREAD_INITIALIZE.
Start - The starting (lowest) address of the stack area provided for the new thread. (For a
swapped thread, this is the swap area.)
Length - The length allocated for the new thread stack.
Swaptions - Characterizes static or swapped threads and thread argument size:
GTS_STATIC specifies a static thread.
GTS_SWAPPED specifies a swapped thread.
GTS_DISCONTIGUOUS can be added to GTS_SWAPPED to specify that the swap area is not a
contiguous area designated by CB.SwapArea. Diagnostic programs cannot display
inactive threads that have discontiguous stacks. Discontiguous stacks are supported on
TNS and TNS/R only and require explicit client logic to copy separate parts.
GTS_STATIC_FILL and GTS_STATIC_RegPerCent (n) can be added to GTS_STATIC.
GTS_STATIC_FILL causes the stack to be filled with a fixed pattern for determining
stack usage.
GTS_STATIC_RegPerCent(n) specifies the percentage of the Length value to be used for
the register stack on TNS/E platforms. This provides greater control of the mem stack
and reg stack allocation. See Section 2.11 and Section 3.6.2 for more information.
Neither of these two options is applicable to protected stacks.
GTS_PROTECTED specifies a static thread with a protected stack
GTS_ARG_64 specifies that a TNS/E application is passing an array of 64-bit wide arguments
through the Arglist parameter. If this option is not specified, then the Arglist parameter is treated
as an array of 32-bit arguments. On a TNS/E platform, each 32-bit parameter is sign-extended into
a 64-bit register. If this option is specified, then the Arglist is treated as an array of 64-bit
arguments.
InitialProc - An untyped procedure that is invoked to begin the new thread.
ArgStart and ArgLen - The address and byte length of a string of argument values to be passed to
the InitialProc.
FinalProc - The procedure to invoke when the initial procedure of the thread exits.
Return: int16
Returns zero if the function succeeds. Returns GT_BAD_MAIN_CB, GT_BAD_CB_NEXT,
GT_BAD_CB_PREV, GT_BAD_..._ALIGN (four cases), GT_BAD_ARGLEN,
GT_BAD_LENGTH, or GT_BAD_SWAPTIONS if an error is detected.
Considerations:
The ArgStart parameter described above designates a set of discrete argument values, not a string
being passed as a single argument. The value string is copied to the new thread by
GTHREAD_INITIATE_, so ArgStart can designate a local area. Any actual argument value can be a
pointer. However, any object designated by a pointer must have a stable lifetime and address,
remaining accessible to the new thread when it becomes active. It must not designate something