/****************************************************************************** * FILE: hello.c * DESCRIPTION: * A "hello world" Pthreads program. Demonstrates thread creation and * termination. * * SOURCE: * LAST REVISED: 9/20/98 Blaise Barney * Modified by Dana Vrajitoru ******************************************************************************/ #include #include #include const int NUM_THREADS = 5; int shared = 10; pthread_mutex_t mutex; void *PrintHello(void *arg) { int threadid = *(int *)arg, id; id = pthread_self(); printf("\n%d: Hello World from %d!\n", threadid, id); pthread_exit(NULL); } int main() { pthread_t threads[NUM_THREADS]; int rc, t; void *arg; for (t=0; t