Qt thread or Python thread

Source: Internet
Author: User

When I was using pyside, I used a thread to load modules.CodeDuring execution, an exception occurred during running. Even a simple print may be abnormal, so I found this discussion on stackoverflow, use the thread module of QT or the thread module of Python.

 

Most people recommend using the QT thread module because it needs to interact with application applications such as qtgui and has the advantages of signal/slot and event loop.

 

However, it is also discussed that Gil exists in Python and is used in the thread module of Python. However, when python uses a third-party module, Gil is released, when Python calls the QT thread, Gil exists in the Python code, while Gil does not exist in the QT thread code, therefore, you need to carefully set the logic and lock the code (this is my problem)

 

In addition, the currentthreadid function of qthread has a bug, which may cause exceptions.

 

Patch pyside. qtcore. qthread. currentthreadid.

 

ImportThread#Patch for qthread. currentthreadid bugQtcore. qthread. currentthreadid = thread. get_ident

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.