/****************************************************************************** * FILE: th_hello.c * DESCRIPTION: * A "hello world" Pthreads program. Demonstrates thread creation and * termination. * * To compile and run this program (in Cygwin): * * $ gcc -lphtread th_hello.c * $ a.exe * * SOURCE: 9/20/98 Blaise Barney * * ADAPTED for Operating Systems Class, Fall 2006 (Chee Yap) * ******************************************************************************/ #include #include #define NUM_THREADS 5 void *PrintHello(void *threadid) { printf("\n%d: Hello World!\n", threadid); pthread_exit(NULL); } int main(int argc, char *argv[]) { pthread_t threads[NUM_THREADS]; int rc, t; for(t=0;t