How to "kill" orphaned threads at program exit
Roy Smith
roy at panix.com
Sun Dec 28 12:47:24 EST 2008
In article
<b133b978-fe63-4893-bb33-8c96bfb59522 at v5g2000prm.googlegroups.com>,
"Giampaolo Rodola'" <gnewsg at gmail.com> wrote:
> Hi,
> I know that it's not possible to "kill" threads but I'm wondering if
> does exist some workaround for my problem.
> I have a test suite which does a massive usage of threads.
> Sometimes happens that one test fails, the test suite keeps running
> until the end, and when it's finished the program hangs on and the
> only way to stop is to kill it manually.
You don't say how you're creating your threads, so I'll assume you're using
threading.Thread(). After creating each thread, and before calling start()
on it, call setDaemon(True).
More information about the Python-list
mailing list