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.
话题:
These articles assume that the reader has basic knowledge about multithreaded applications.
线程类
这些类有关线程化应用程序。
于整数上独立于平台的原子操作 |
|
为指针提供独立于平台的原子操作的模板类 |
|
表示异步计算的结果 |
|
简化 QFuture 同步的方便类 |
|
允许监视 QFuture 使用信号和插槽 |
|
在线程之间串行化访问 |
|
简化锁定和解锁互斥的方便类 |
|
用于读取访问的锁定和解锁的读写锁的方便简化类 |
|
读写锁 |
|
用于所有可运行对象的基类 |
|
通用计数信号量 |
|
异常安全的 QSemaphore::release() 调用的延迟 |
|
独立于平台的线程管理办法 |
|
管理 QThread 的集合 |
|
每线程数据存储 |
|
用于同步线程的条件变量 |
|
用于写入访问的锁定和解锁的读写锁的方便简化类 |
|
使之无需使用低级线程原语就能编写多线程程序的高级 API |
注意: 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.