This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

daemon thread  RSS feed

 
ramesh kumar
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
daemon thread has to terminate immediatly after parent thread terminate,but in my program it is taking some time why?
 
Henry Wong
author
Sheriff
Posts: 23279
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by ramesh kumar:
daemon thread has to terminate immediatly after parent thread terminate,but in my program it is taking some time why?


Unfortunately, your premise is incorrect. Daemon threads do not terminate when the parent thread terminates.

Daemon threads do not prevent the JVM from exiting, meaning that if only daemon threads are running the JVM may exit. If even a single user thread is running, the JVM will continue to run, along with the Daemon threads. (And even when exiting, I don't recall any mention of "immediately")

Henry
[ August 18, 2006: Message edited by: Henry Wong ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!