Example (_getTIBvalue -- Get Thread Information Block Value)

This example prints out all the values in the TIB structure.

#define INCL_DOS
#include <os2.h>
#include <builtin.h>
#include <stdio.h>
#include <stddef.h>
int main(void)
{
   printf("Values in Thread Information Block are:\n\n" );
   printf("Exception chain pointer: %lx\n",
          _getTIBvalue(offsetof(TIB, tib_pexchain)));
   printf("Base stack address: %lx\n",
          _getTIBvalue(offsetof(TIB, tib_pstack)));
   printf("End of stack address: %lx\n",
          _getTIBvalue(offsetof(TIB, tib_pstacklimit)));
   printf("System specific TIB pointer: %p\n",
          _getTIBvalue(offsetof(TIB, tib_ptib2)));
   printf("Version number: %lu\n",
          _getTIBvalue(offsetof(TIB, tib_version)));
   printf("Ordinal number: %lu\n",
          _getTIBvalue(offsetof(TIB, tib_ordinal)));
   return 0;
   /****************************************************
      The output should be similar to :
      Values in Thread Information Block are:
      Exception chain pointer: 38844
      Base stack address: 30000
      End of stack address: 38860
      System specific TIB pointer: 50048
      Version number: 20
      Ordinal number: 122
   ****************************************************/
}