Using/Omitting pthread_join()

Reply

Join Date: Feb 2005
Posts: 78
Reputation: nanodano is an unknown quantity at this point 
Solved Threads: 2
nanodano's Avatar
nanodano nanodano is offline Offline
Junior Poster in Training

Using/Omitting pthread_join()

 
0
  #1
Apr 6th, 2007
When programming with pthreads, you pass the thread a function to run when you create it. When this function is done, is the thread cleaned up automatically? Is it necessary to put pthread_join() in the calling function somewhere? Is pthread_join only useful when you want to wait for a thread to finish?
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 31
Reputation: mcldev is an unknown quantity at this point 
Solved Threads: 2
mcldev mcldev is offline Offline
Light Poster

Re: Using/Omitting pthread_join()

 
0
  #2
Aug 10th, 2007
You should always kill the threads as the finish up the work. So you need to join the thread in order to stop it. Threads can provide significant overhead if left to run wild so make sure you clean up all threads in your exit handler.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC