In my program i have 10 threads working simultaneously, the threads are used to fetch data(one row per thread)from the database and send it to some other method. when the data in the database reaches the nth record the first thread that encounters this will spawn a main governing thread and it dies out. My problem is that i have to wait till all the other threads die out for the main governing thread to continue with its operation. How can i know the wait time for the main governing thread to suspend with its operation till all the other threads die out. Can anyone give me a solution for how to wait till the other threads die out and then continue with the main threads execution... NOTE: All the threads are individual threads, they are not in a single pool..
Well, you could always use another for loop around the join() calls. Copying the same code 10 times (with a slight change of index) is often a clue that a for loop can be introduced. Other than that, what's wrong with the way the code "looks"?
"I'm not back." - Bill Harding, Twister
Joined: Feb 28, 2007
I made change to the code, availing the benefit of for loop: