Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Demon Thread  RSS feed

 
Sunil Mamindla
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
 
bill bozeman
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.
 
Prabhjyot Singh
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!