Re: QThread.terminate in Python 3

Discussion in 'Python' started by Lee Harr, Sep 29, 2012.

  1. Lee Harr

    Lee Harr Guest


    >> 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.
    Lee Harr, Sep 29, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Pradnyesh Sawant

    problem with qthread and signal/slot

    Pradnyesh Sawant, Apr 14, 2007, in forum: Python
    Replies:
    0
    Views:
    460
    Pradnyesh Sawant
    Apr 14, 2007
  2. daved170

    PyQT Qthread stuck main app

    daved170, Sep 15, 2009, in forum: Python
    Replies:
    0
    Views:
    426
    daved170
    Sep 15, 2009
  3. Lee Harr

    QThread.terminate in Python 3

    Lee Harr, Sep 23, 2012, in forum: Python
    Replies:
    0
    Views:
    203
    Lee Harr
    Sep 23, 2012
  4. Dennis Lee Bieber

    Re: QThread.terminate in Python 3

    Dennis Lee Bieber, Sep 23, 2012, in forum: Python
    Replies:
    0
    Views:
    192
    Dennis Lee Bieber
    Sep 23, 2012
  5. Dennis Lee Bieber

    Re: QThread.terminate in Python 3

    Dennis Lee Bieber, Sep 29, 2012, in forum: Python
    Replies:
    0
    Views:
    247
    Dennis Lee Bieber
    Sep 29, 2012
Loading...

Share This Page