Python Forum

Full Version: Joining a Daemon Thread
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've asked this question twice (1,2), and for whatever reason I haven't been able to get an answer. Could someone please take a few minutes out of there day to help me?

I was reading about threads, more specifically daemon threads, and I came across this post, quote:

Quote:But joining a demonized thread opens most likely a whole can of trouble! I'm now considering to remove the join() call in my little diagram for the daemon-thread

Questions:
  1. Why is joining a daemon thread considered bad practice?
  2. Can I call thread.is_alive() on a daemon thread?


Sorry, if I come off as rude in the beginning, but I don't know what I've done on SO that makes my questions get ignored or go unanswered. I hope some one here can help me Smile
1. Deamon threads are made to keep running until they are done or programming closes. So if you have a deamon thread that does not stop it self. Then it waiting for the programming to exit. So you don't want your programming waiting for it to end.
Deamon threads explain.

2. Yes it okay.

After reading this pos . Looks like someone else answer your question there.
(Nov-21-2017, 09:34 PM)Windspar Wrote: [ -> ]1. Deamon threads are made to keep running until they are done or programming closes. So if you have a deamon thread that does not stop it self. Then it waiting for the programming to exit. So you don't want your programming waiting for it to end.

So in way, your defeating the purpose of a daemon thread if you call .join() on it? Because it's supposed to do it's work and die in the background, sort of as a set it and forget it approach?
Yes.
Because if you have one that never ends. Then your program will be waiting forever with .join(). You just created a zombie.
Deamon threads will end when the program does.