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 17 of 44
The caller of this function should typically link the new thread onto its list of threads ready to run.
Subsequent calls to GTHREAD_SWAPIN_SETUP_ (for a swapped thread) and
GTHREAD_LONGJMP_ will "resume" the thread at its beginning, which is a call to the InitialProc.
2.8. TNS/E Migration Aid
GTH_GET_ESTIMATED_STACK_SIZE_( int32 sizeEstimate )
Description:
Provides the caller with a TNS/E adjusted stack size given an estimated TNS/R size. May be called
for either static or swapped threads.
Input:
SizeEstimate - Estimated size in bytes; size provided must be based on a TNS/R implementation.
Return: int32
Returns the estimated stack size in bytes.
Considerations:
Use of this interface is optional. The client is free to derive the appropriate stack size for the target
platform by other means.
This interface should be called prior to stack space allocation and thread creation
(GTHREAD_INITIATE_) to determine the appropriate stack size based on the host platform.
If called on a TNS/R host or in a TNS (non-native) process, the interface returns sizeEstimate (no
resizing necessary).
2.9. Access Functions
The functions in this and the next two sections interface to attributes of the thread. To the greatest
extent possible, these functions mask architectural dependencies. Where a TNS/E program requires
this information or action, it must use this interface. Direct access to the CB structure fields remains
an option in TNS and TNS/R programs; use of this interface increases portability.
GTH_ALLOCATED_SIZE_( GThread_CB cb )
Description:
Returns the size of the memory space in bytes that was allocated by the client and provided to
GTHREAD_INITIATE_ for static/swapped stack usage. May be called for either static or swapped
threads. Replaces directly accessing the thread control block element StackSize which in actuality
was the value passed to GTHREAD_INITIATE_.
Input:
cb -The address of the thread control block.
Return: int32
Returns the amount of stack space allocated (available) to the thread in bytes.
Considerations:
None.