Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Java
Expertise: Intermediate
Feb 1, 2001

Take Control of the Threads Created By a Program


Whenever a thread is created in a program, it is unknown when it will execute. This means there may be cases where the parent program has finished but the thread is still executing. One way to ensure that the main program exits only after the thread is finished with its work is by employing Joins. Join is a member function of the Java thread class.

Write this code at the end of the main thread:
 
t1.Join();

This command will wait until the thread t1 has finished its work.
Shantanu Garg
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap