Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

regarding daemon thread

 
Suseela doddi
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why do set any thread as daemon thread and wats use of that.
thanks in advance.

regards
chandu
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to "Threads and Synchronization."
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JVM will exit when all the threads that remain running are daemon threads. Therefore, if you want to create a Thread that runs as a sort of background task, and you don't want the program to continue running if your main thread terminates but the background task remains, then you should make that background thread a daemon thread.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic