void ThreadTest() { int tid; tid = threadCreate("smr", SimpleThread); /* Creating a thread */ n_printf("Entering SimpleTest"); SimpleThread(2); /* Calling the function with argument to distinguish between the threads */ }
void main() { Write(" Entering Main Thread ", 22,1); NewLine(); Print(" P Entering Main Thread ", 24,1,-1); NewLine(); Fork(SimpleThread, 1); SimpleThread(0); Write(" Exiting the main thread ",25,1); NewLine(); PrintTab(); Print(" P Exiting the main thread ",27,1,-1); NewLine(); }
void* callSimpleThread(void *arg){ struct mythread* t = (struct mythread*)arg; SimpleThread(t->idx); return 0; }