Listing 3

/* ************************************************* */
/* Demonstration of technique for multi-threading C */

#define  NULL 0
main()
{
  extern case0(), case1(), case2() ;
  thread( case0, case1, case2, NULL) ;
}
int case0()
{
   printf("** First thread part 1 ** ) ;
   threadswitch() ;
   printf("** First thread part 2 ** ) ;
}
int case1()
{
   printf("** Second thread part 1 ** ) ;
   threadswitch() ;
   printf("** Second thread part 2 ** ) ;
}
int case2()
{
   printf("** Third thread part 1 ** ) ;
   threadswitch() ;
   printf("** Third thread part 2 ** ) ;
}