User-Level Native Thread Primitives (GThread) Library White Paper (G06.26+)

User-Level Native Thread Primitives (GThread Library) 03/31/2005
Hewlett-Packard Company--540065-001 Page 18 of 46
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. Callable for either static or swapped
threads. Replaces directly accessing the thread control block element StackSize which in actuality
was the space 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.
GTH_ALLOCATED_BASE_( GThread_CB cb )
Description:
Returns the base (lowest) address of the allocated stack space for the specified thread. Callable 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.
Considerations:
None.