#include #include #include #define NUM_THREADS 5 void *PrintHello(void *threadid) { long tid; int pid; tid = (long)threadid; if (fork() == 0) /* in child */ { printf("Hello World! It's me, child in thread #%ld!\n", tid); sleep(10); printf("Good bay World! It's me, child in thread #%ld!\n", tid); exit(0); } sleep(5); printf("Good Bay World! It's me, thread #%ld!\n", tid); pthread_exit(NULL); } int main (int argc, char *argv[]) { pthread_t threads[NUM_THREADS]; int rc; long t; for(t=0; t