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 30 of 44
GTHREAD_MAINCONTEXT_CHECK_( GThreadCB MainCB )
Description:
Checks for errors in the main context. May be called only for swapped threads.
Input:
MainCB - The address of the thread control block that was established by
GTHREAD_INITIALIZE_.
Return: int16
Returns zero if the mem and reg (TNS/E) stacks are each resting within their initial bounds. Returns
nonzero if either the mem or reg (TNS/E) stack pointer in the MainCB is beyond (tipward of) its
swap origin.
Considerations:
This interface checks for errors in the main context as determined by examining 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 detect swap-overflow of the unthreaded (master)
code.
On platforms other than TNS/E native, the concept of a separate reg stack does not exist. In these
cases, only the mem stack of the main context is examined for errors.
GTHREAD_CONTEXT_LENGTH( void )
Description:
Returns the length of the significant context in a GThread_CB.
Input:
None.
Return: int32
Returns the length of the significant context in a GThread_CB.
Considerations:
The data at Gthread_Private for this length (in bytes) can be used to checkpoint the thread context.
(This value is constant on any system; it is less than the length of the whole substruct because some
space is reserved, but not yet used.)
2.13. Termination
GTHREAD_TERMINATE_( GThread_CB cb )
Description:
Terminates the thread and delinks it from the list of threads. May be called for either static or
swapped threads.
Input:
cb - The address of the defunct thread control block, which should be inactive.