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 11 of 46
GTHREAD_BYTES(TSize,NSize)
evaluates to an INT(32) stack length in bytes. This macro might help to deal with stack alignment and
length architecture requirements: TNS, TNS/R, and TNS/E stacks differ in terms of stack
requirements for the same processing.
INT TSize
specifies the TNS stack length in 16-bit words;
INT(32) NSize
specifies the native stack length in bytes; it is rounded up to a multiple of 8 for TNS/R and 16 for
TNS/E.
Compile-time selection uses one parameter or the other to compute the length or alignment
appropriate for the current architecture; it is a compile-time constant if TSize and NSize are constant
expressions.
GTHREAD_VERSION indicates the version of the GTHREAD_CB_TEMPLATE structures being
used; it must match those with which the GTHREAD procedures were compiled. The first three bytes
are ASCII "GTh".
GTHREAD_CB(id) is a TAL define that declares or specifies
INT .EXT id (GThread_CB_Template)
(In C/C++, GThread_CB_Template is a typedef for a GThread Control Block;
GThread_CB is a typedef for pointer to GThread_CB_Template.)
The following literals define error return values:
GT_OK = 0: All GTHREAD functions that report an error code return 0 upon successful
completion.
GT_BAD_VERSION: The client program was compiled with a different data-structure version than
the GThread primitive procedures.
GT_BAD_ORIGIN: GTHREAD_ORIGIN_SET_ found MainCB.StackOrigin not at its initial value.
When the swapped master protocol is coded as sketched in Section 3.2 this error indicates
that the unthreaded master stack is now deeper than initially.
GT_BAD_MAIN_CB: MainCB.GTh_Marker is wrong: the structure is corrupted, or
GTHREAD_INITIALIZE_(...,MainCB) was not called.
GT_BAD_MAIN_STATE: The MainCB context is not valid: the structure is corrupted, or
GTHREAD_SETJMP_(MainCB,...) was not called