• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Demon Thread

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai !
Why we set a thread as a demon thread
Thanks in advance
------------------
Sunil
 
Ranch Hand
Posts: 1070
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From my understanding, daemon threads are threads that are dependent on the thread that started them. So if you have a thread main, and it starts 10 other threads, but as soon as main ends, you want those other 10 threads to stop also, then you would use daemon threads. User threads don't stop when the thread that started them stops. There are probably more reasons and better reasons to use them, but that is what I know about them.
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
But in some JVM implementations if u set high priority to daemon threads they just won't get killed by the jvm as soon as it's parent user thread gets killed.Anyway never make ur application rely on thread timing/priority since it is not predictable.Rather do the task in c/c++ in any native method if portability is not a consideration.
prabh
 
Roses are red, violets are blue. Some poems rhyme and some don't. And some poems are a tiny ad.
create, convert, edit or print DOC and DOCX in Java
https://products.aspose.com/words/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!