On Sun, 23 Sep 2012 20:39:11 +0430, Lee Harr <>
declaimed the following in gmane.comp.python.general:
> I understand that use of QThread.terminate is discouraged,
> but it has worked well previously and I would like to continue
> this use if possible.
>
And now you've encountered the reason it is discouraged.
Pretty much ALL the threading libraries I've encountered discourage
arbitrary "killing" of threads. The recommended method is a cooperative
system by which the threads detect, somehow, a signal (special token on
an input queue, global boolean, thread-local boolean that can be set
external to the thread, etc.) and then clean up and exit "normally".
Likely the presense of time.sleep() in the thread is providing: 1) a
task switch to the main thread (or whichever) is invoking the
termination and, 2) a clean thread state where termination doesn't risk
any dangling operations [the thread is blocked waiting for a signal to
continue] vs having a task switch occur in the middle of a sequence of
Python op-codes and then being terminated with an unfinished
statement...
--
Wulfraed Dennis Lee Bieber AF6VN
HTTP://wlfraed.home.netcom.com/