• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Threads from threads

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic