dcsimg
How to wait for all son threads' end in main thread?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Chen_Ruiming
Posted On:   Saturday, April 20, 2002 11:02 PM


I create some son threads in main thread, and want to get the values of the threads,so i wait:



while(tg.getActiveCount()>0) //tg is a thread group



{}


But this method costs too much resource, is it?How to improve it?

Re: How to wait for all son threads' end in main thread?

Posted By:   Mike_Friedrich  
Posted On:   Monday, April 22, 2002 03:48 AM

Hi, use this:

while(tg.getActiveCount()>0) //tg is a thread group
{
Thread.sleep(100); // wait 100 ms
}
About | Sitemap | Contact