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 14 of 44
additional “resting” space is reserved for the principal stacks. May be called for either static or
swapped threads.
Input:
MainCB - The address of the thread control block that was established by
GTHREAD_INITIALIZE_.
moreStack - Number of bytes by which to increase the “resting” space on the mem stack.
moreRegStack - Number of bytes by which to increase the “resting” space on the reg stack.
Return: int16
Returns zero if the function succeeds. Returns GT_BAD_ORIGIN, GT_BAD_MAIN_CB, or
GT_BAD_MAIN_STATE if an error is detected.
Considerations:
If moreStack is less than 0, moreRegStack is disregarded and the stack origins are set without any
modification.
If moreStack is greater than or equal to 0 and moreRegStack is less than 0, the moreStack value is
applied to each of the two stacks prior to setting the stack origins.
If moreStack is greater than or equal to 0 and moreRegStack is greater than or equal to 0, moreStack
is applied to the mem stack and moreRegStack is applied to the reg stack prior to setting the stack
origins.
If moreStack is rounded up to a multiple of 2 on TNS and a multiple of 8 on TNS/R. Both moreStack
and moreRegStack are each rounded up to a multiple of 16 on TNS/E.
On platforms other than TNS/E native, the concept of a separate reg stack does not exist and the
moreRegStack parameter is ignored.
Either this procedure or GTHREAD_ORIGIN_SET_ must be called once. See the discussion and
examples under "Usage" in Section 3.
2.7. Initiation
A program creates a new thread by allocating a GThread_CB and a stack area, and invoking the following
procedure.
GTHREAD_INITIATE_( GThreadCB CB,GThreadCB MainCB,
void *Start, int32 Length,
int16 Swaptions,
GTH_FUNC InitialProc,
void *ArgStart, int32 ArgLen,
GTH_FUNC FinalProc)
Description:
Initiates a thread by setting up the thread control block, building an initial stack image, and linking
the new thread onto the list of threads. May be called for either static or swapped threads.
Input:
CB - The address of the thread control block for the new thread.