![]() To run code in one of a QThreadPool's threads, reimplement QRunnable::run() and instantiate the subclassed QRunnable. QThreadPool is a collection of reusable QThreads. To reduce this overhead, existing threads can be reused for new tasks. QThreadPool and QRunnable: Reusing ThreadsĬreating and destroying threads frequently can be expensive. See the QThread class reference and the threading examples for demonstrations on how to use QThread. Subclassing a QThread allows the application to initialize the new thread before starting its event loop, or to run parallel code without an event loop. Instantiating a QThread provides a parallel event loop, allowing QObject slots to be invoked in a secondary thread. ![]() QThread can either be instantiated directly or subclassed. Each QThread instance represents and controls one thread. QThread is the foundation of all thread control in Qt. QThread: Low-Level API with Optional Event Loops Below are four different approaches that Qt programmers can use to implement multithreaded applications. Qt offers many classes and functions for working with threads.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |