Thread.setDaemon()
Pages
Profile
|
|
Hi, I'm Veerapat Sriarunrungrueang, an expert in technology field, especially full stack web development and performance testing.This is my coding diary. I usually develop and keep code snippets or some tricks, and update to this diary when I have time.
Nowadays, I've been giving counsel to many well-known firms in Thailand.
view more... |
Thursday, October 6, 2011
How to force a thread to stop when the main program has been closed in Python
Last week, I had done with Tkinter GUI programming, and that program requires a lot of processing power to crawl and parse web pages.
So, when I was running the program, it was hang. The solution is using multi-threading, but I found a next problem that threads were not killed
when the main program was closed. To stop threads, we need to set daemon thread letting the threads die when the program is terminated.
Labels:
Programming,
Python,
Threading
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment