skip to Main Content

Thread creation in C – Ubuntu

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 %dn", t); rc = pthread_create(&thread[t], NULL, BusyWork, (void *)&t); sleep(1); if (rc) { perror("pthread_create"); exit(EXIT_FAILURE); }…

VIEW QUESTION
Back To Top
Search