i am writing a program with threads. it's a simple program in which user will enter how many number of thread he want to be created.
what technique we use to create multiple threads ??

using for loop ???
suppose to run 3 threads...

for(c=0; c<3; c++ ){      
   pthread_create(&thread[c], NULL, thread_func, NULL);
}

if i use the above case how can i use my thread join statement to wait for all 3 threads???

if (pthread_join(threada[0], NULL) != 0)

is my question described very poorly ???
OR
people on this site never have an answer for me ????

Wait for (join) all the threads.

for (i=0;i<3;i++) 
	pthread_join(thread[i], NULL);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.