• Post Reply Bookmark Topic Watch Topic
  • New Topic

Threads from threads

 
Andy Lawson
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
What happens when you launch a thread from a within a thread, and the parent thread goes to sleep? Does the child thread keep running? (providing it was doing something when the parent went to sleep.)
I know I should probably try a little program to do this, but I'm very lazy.
Anybody got an idea, answer etc.
Thanks,
Andy.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The death of the parent has no effect on the child. They are independant. The only exception to this is that if the child is a daemon (setDaemon(true)) and the parent is not, and there are no other non-daemon threads running, then when the parent dies, the JVM can exit, ven though the daemon child was still running. That's the whole point of daemon threads. But that doesn't really have anything to do with the parent-child relationship.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!