Terminate a thread in QT

Source: Internet
Author: User

In Qt, it is not possible to terminate a thread directly, which is somewhat different from WINAPI's control of the thread, which is sometimes troublesome, such as in some cases where the thread is expected to terminate immediately. A few ways to summarize:

1. Using the QT API

Threadvector[i]->terminate (); Terminating a thread
Threadvector[i]->wait (); Blocking wait

Reference: http://blog.csdn.net/u012150179/article/details/17618769

2. QT should be able to call WINAPI directly, then when it is VC good ~ ~ ~

3. Accidental discovery, the callback function also has the function, may immediately stop the operation of the current function (but only if the current function in the course of execution, constantly call this callback function)

Terminate a thread in QT

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.