Re: QThread.terminate in Python 3
>> 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:
I found another possible approach here:
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.
|All times are GMT. The time now is 09:36 PM.|
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.