Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

daemon Thread  RSS feed

 
Rajib Sarma
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
What is the difference between a normal thread and a Daemon thread? In my application, I have a thread that keeps on running for a very long time, may be for months/years. Should I make this thread a daemon thread? What may happen if I donot make it a daemon thread?
Thanks
-Rajib
 
satyendra gurjar
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As long as a user thread is alive, the program execution does not terminate.
program execution terminates when there is no user thread is alive.
A daemon thread is stopped if there are no more user thread is running, thus terminating the program.
Hence daemon threads exist only to serve user threads.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!