Thread creation in C
Can somebody please explain why the following loop for thread creation fails without the sleep function call? for(t=0; t<NUM_THREADS; t++) { printf("Main: creating thread %d\n", t); rc = pthread_create(&thread[t], NULL, BusyWork, (void *)&t); sleep(1); if (rc) { perror("pthread_create"); exit(EXIT_FAILURE); } } If sleep is not inserted then thread function seems to take as an argument… Read More Thread creation in C