Home · All Classes · All Functions · Overviews

[Next: Starting Threads with QThread]

Thread Support in Qt

Qt provides thread support in the form of platform-independent threading classes, a thread-safe way of posting events, and signal-slot connections across threads. This makes it easy to develop portable multithreaded Qt applications and take advantage of multiprocessor machines. Multithreaded programming is also a useful paradigm for performing time-consuming operations without freezing the user interface of an application.

Earlier versions of Qt offered an option to build the library without thread support. Since Qt 4.0, threads are always enabled.


Recommended Reading

This document is intended for an audience that has knowledge of, and experience with, multithreaded applications. If you are new to threading see our Recommended Reading list:

The Threading Classes

These classes are relevant to threaded applications.

Asynchronous RunThe <QtConcurrentRun> header provides a way to run a function in a separate thread.
Concurrent Filter and Filter-ReduceThe <QtConcurrentFilter> header provides concurrent Filter and Filter-Reduce.
Concurrent Map and Map-ReduceThe <QtConcurrentMap> header provides concurrent Map and MapReduce.
QAtomicIntPlatform-independent atomic operations on integers
QAtomicPointerTemplate class that provides platform-independent atomic operations on pointers
QFutureRepresents the result of an asynchronous computation
QFutureSynchronizerConvenience class that simplifies QFuture synchronization
QFutureWatcherAllows monitoring a QFuture using signals and slots
QMutexAccess serialization between threads
QMutexLockerConvenience class that simplifies locking and unlocking mutexes
QReadLockerConvenience class that simplifies locking and unlocking read-write locks for read access
QReadWriteLockRead-write locking
QRunnableThe base class for all runnable objects
QSemaphoreGeneral counting semaphore
QThreadPlatform-independent threads
QThreadPoolManages a collection of QThreads
QThreadStoragePer-thread data storage
QWaitConditionCondition variable for synchronizing threads
QWriteLockerConvenience class that simplifies locking and unlocking read-write locks for write access
QtConcurrentHigh-level APIs that make it possible to write multi-threaded programs without using low-level threading primitives

Note: Qt's threading classes are implemented with native threading APIs; e.g., Win32 and pthreads. Therefore, they can be used with threads of the same native API.

[Next: Starting Threads with QThread]

Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies) Trademarks
Qt 4.6.3