Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: QThread.terminate in Python 3

18 views
Skip to first unread message

Lee Harr

unread,
Sep 28, 2012, 10:04:00 PM9/28/12
to pytho...@python.org

>> 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.

Ok. Point taken.

What I hear you saying is that once I use .terminate anything
following that is indeterminate. It might work on my system
and nowhere else. Even though it was working for me before,
it was likely causing trouble elsewhere.


So, I need another approach.

The problem I am facing is that I want to run arbitrary
(user-supplied) code in the other thread and need to be
able to stop it at any time.

This is for a python turtle-graphics application:
http://pynguin.googlecode.com/


I found another possible approach here:
http://tomerfiliba.com/recipes/Thread2/

It uses ctypes to raise an exception in the other thread.
For the simple test case, at least, it works (for me).

Is this any safer or more reliable than .terminate ?

Is it portable? ie, if I build this in to my actual application
and it works for me, is it likely to work for everyone?


Thanks for any insight.


Message has been deleted
0 new messages