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 18 of 44
GTH_ALLOCATED_BASE_( GThread_CB cb )
Description:
Returns the base (lowest) address of the allocated stack space for the specified thread. May be called
for either static or swapped threads. For a swapped thread, the base address returned is the base of
the swap area. For a static thread, it is the base of the static stack area. Replaces accessing the thread
control block element SwapArea for swapped threads, or the elements StackOrigin and StackSize
to determine the base of the allocated area for static threads.
Input:
cb - The address of the thread control block.
Return: void *
Returns the base address of the allocated stack space. If no space was allocated, returns a NULL
pointer.
GTH_STACK_USED_( GThread_CB cb )
Description:
Returns the number of bytes of allocated stack space that is currently in use on the user stack. May
be called for either static or swapped threads. Replaces accessing the thread control block element
StackUsed.
Input:
cb -The address of the thread control block being checked.
Return: int32
Returns the number of bytes of stack space being used at the point where GTHREAD_SETJMP_
was last called.
Considerations:
This interface returns stack usage information captured at the last call to GTHREAD_SETJMP_
when the thread was active. It is provided for users of swapped threads who wish to manage swap-
area overflow. This interface should not be used to monitor stack usage on a running thread; its result
is valid only after a call to GTHREAD_SETJMP_.
For native TNS/E threads, the returned value is the sum for both stack components.
GTH_STACK_USED_DETAIL_( GThread_CB cb , int32* mem_used, int32* reg_used )
Description:
Returns the number of bytes of allocated stack space that is currently in use on both the mem and the
reg stacks. This function extends the GTH_STACK_USED_ functionality to return individual stack
used values for the mem and reg stacks, rather than returning a sum of these two values. May be
called for either static or swapped threads.
Input:
cb - The address of the thread control block being checked.
mem_used Pointer to location for the amount of mem stack space being used in bytes at the
point where GTHREAD_SETJMP_ was last called.