Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Joining a Daemon Thread
#1
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
Reply
#2
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.
99 percent of computer problems exists between chair and keyboard.
Reply
#3
(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?
Reply
#4
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.
99 percent of computer problems exists between chair and keyboard.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Joining two jupyter notebooks and getting an error! Led_Zeppelin 1 1,129 Oct-20-2022, 04:28 PM
Last Post: deanhystad
  What is the value after JOINING an empty list? JaneTan 2 5,176 Jan-04-2021, 06:25 PM
Last Post: deanhystad
  Access a variable of a daemon peek_no_boo 8 3,372 Apr-03-2020, 07:29 PM
Last Post: BrendanD
  Error SQLite objects created in a thread can only be used in that same thread. binhduonggttn 3 15,554 Jan-31-2020, 11:08 AM
Last Post: DeaD_EyE
  Python - joining xmls together invalid token error jan86 0 2,211 Apr-26-2019, 08:52 AM
Last Post: jan86
  Joining two tables together tryingtolearnpython 0 2,219 Jul-22-2018, 11:29 AM
Last Post: tryingtolearnpython
  joining a variable number of lists in a comprehension Skaperen 2 2,803 Oct-14-2017, 08:19 AM
Last Post: Skaperen
  Joining results acmichelman 5 3,914 Sep-11-2017, 09:03 PM
Last Post: nilamo
  How do you wait for a daemon to reach a certain state with subprocess.popen()? phalse 3 7,833 Jul-08-2017, 12:32 PM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020