What is the proper way of killing a non daemon thread? I have program that is connected (asyncio) to an API and constantly receiving data from the server, this connection must run in a "normal" thread because if I set it to daemon it no longer works. The problem right now is, this connection remains open if I close the program. I can implement a signal to stop the thread when the exit button is clicked, but what if the program is closed in the task manager?
I guess my question is, does the program leave behind (after its compiled to an exe) the running thread if it is not closed with the button click? Or it will be closed despite I still see the thread running in the Visual Studio Code console if I click the exit button?
https://stackoverflow.com/questions/66996297/how-to-kill-a-non-daemon-thread-when-closing-the-program-in-python April 08, 2021 at 09:48AM
没有评论:
发表评论