IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

Thread Support in Qt

A detailed discussion of thread handling in Qt.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

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.

Topics:

The Threading Classes

These classes are relevant to threaded applications.

  • Concurrent Filter and Filter-Reduce:

  • Concurrent Map and Map-Reduce:

  • Concurrent Run:

  • QAtomicPointer: The QAtomicPointer class is a template class that provides platform-independent atomic operations on pointers.

  • QFuture: The QFuture class represents the result of an asynchronous computation.

  • QFutureSynchronizer: The QFutureSynchronizer class is a convenience class that simplifies QFuture synchronization.

  • QFutureWatcher: The QFutureWatcher class allows monitoring a QFuture using signals and slots.

  • QMutex: The QMutex class provides access serialization between threads.

  • QMutexLocker: The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes.

  • QSemaphoreReleaser: The QSemaphoreReleaser class provides exception-safe deferral of a QSemaphore::release() call.

  • QThread: The QThread class provides a platform-independent way to manage threads.

  • QThreadStorage: The QThreadStorage class provides per-thread data storage.

  • QtConcurrent: The QtConcurrent namespace provides high-level APIs that make it possible to write multi-threaded programs without using low-level threading primitives.

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.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+