Skip to content Skip to sidebar Skip to footer

Create Daemon Thread

I'm trying to create a daemon thread under Windows, but I have no clue what am I doing wrong. The code below is acting as a normal thread: I don't see 'End run' written to the cons

Solution 1:

The following:

self.thread.run()

should read:

self.thread.start()

Otherwise, thread_run() is getting called in the context of the current thread, and not in the context of a new thread.

The thread_run() function never returns (because self.isrunning never changes), and the code never reaches the print statement.

Post a Comment for "Create Daemon Thread"