// thread_simple.c -- multithreaded "hello world" #include #include #include #include #define NTHREADS 4 #define errexit(code,str) \ fprintf(stderr,"%s: %s\n",(str),strerror(code)); \ exit(1); // this is the thread code void *hola(void * arg) { int myid=*(int *) arg; printf("Hello, world, I'm %d\n",myid); return arg; } // this is the main thread's code int main(int argc,char *argv[]) { int worker; pthread_t threads[NTHREADS]; // holds thread info int ids[NTHREADS]; // holds thread args int errcode; // holds pthread error code int *status; // holds return code // create the threads for (worker=0; worker