Hi All, Here is a scenario. A main programme spawns few threads(each thread may take it's own time for completion) and the main thread has to finish after all the threads have completed. Can anyone help me with a code snippet or skeleton code for the above scenario. Regards, Sharath
To wait for all threads to complete execution, you just need to make sure you maintain a reference to each thread object, and then your main thread can simply call each thread object's join() method in turn. It doesn't matter which order the threads actually complete in. For example:
[ December 02, 2007: Message edited by: Kelvin Lim ]
posted 11 years ago
thanks a lot Kelvin for the answer .... I got a clear example for the solution of the scenario I was looking for.
See ya later boys, I think I'm in love. Oh wait, she's just a tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database