IntelliJ Java IDE
The moose likes Threads and Synchronization and the fly likes Parent Thread stops then does child thread also stop? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "Parent Thread stops then does child thread also stop?" Watch "Parent Thread stops then does child thread also stop?" New topic
Author

Parent Thread stops then does child thread also stop?

Sudha Lakshman
Greenhorn

Joined: Nov 26, 2001
Posts: 17
hi i had a doubt. In java if i am spawning child thread(s) from a thread other than the main thread of the program, and i stop the parent thread, will the child thread also stop? or do I have to stop the child thread explicitly?(one way of doing this is by using join() method).
In other words if i plan to interrupt the Parent thread then will the child thread also get interrupted and hence stop?
please do let me know.
regards
sudha
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18652
No, the child will be independant - if you want to interrupt it, you must do so separately.


"I'm not back." - Bill Harding, Twister
Sudha Lakshman
Greenhorn

Joined: Nov 26, 2001
Posts: 17
Hi Mr.Jim Yingst,
Thank you for replying so promptly and clearing my doubt.
regards
sudha
 
 
subject: Parent Thread stops then does child thread also stop?
 
Threads others viewed
How to kill a child thread from its parent?
Sleeping Threads
Please help me solve this
thread
Example of Reflexive composition relation.
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com