您的位置:首页 > 编程语言 > Qt开发

[翻译]QT中的线程支持

2014-05-08 13:54 197 查看
QT中的线程支持

原英文页面:http://qt-project.org/doc/qt-4.8/threads.html

QT提供的线程支持以平台无关的线程类、线程安全的post events方式,以及跨线程的信号-槽机制组成。这使得开发可移植的多线程QT应用以及多处理器资源的充分利用十分容易。多线程编程也是处理耗时操作而不冻结应用UI交互的良好规范。


Topics:主题

Recommended Reading
---推荐阅读

The Threading Classes
---线程类

Starting Threads with QThread
---使用QThead进行线程开发

Synchronizing Threads
---同步线程

Reentrancy and Thread-Safety
---可重入与线程安全

Threads and QObjects
---线程和QObjects(QT中的基类)

Concurrent Programming
---并发编程

Thread-Support in Qt Modules ---QT模块中的线程支持


推荐阅读:

这篇文档是写给那些具有多线程编程基础且有实际经验的读者,如果你不太熟悉线程相关知识,可以参考我们的阅读目录:

Threads Primer: A Guide to Multithreaded
Programming

Thread Time: The Multithreaded Programming
Guide

Pthreads Programming: A POSIX Standard
for Better Multiprocessing

Win32 Multithreaded Programming


线程相关类:

这些是与线程相关的类

Asynchronous Run
The <QtConcurrentRun> header provides a way to run a function in a separate thread.

这个头文件提供了一种在分离的线程中运行函数的方法

Concurrent Filter and Filter-Reduce
The <QtConcurrentFilter> header provides concurrent Filter and Filter-Reduce.

这个头文件提供了并发Filter和 Filter-Reduce.

Concurrent Map and Map-Reduce
The <QtConcurrentMap> header provides concurrent Map and MapReduce.

这个头文件提供了并发Map和MapReduce

QAtomicInt
Platform-independent atomic operations on integers

提供平台无关的对于整型的原子操作

QAtomicPointer
Template class that provides platform-independent atomic operations on pointers

模板类,提供平台无关的对于指针的原子操作

QFuture
Represents the result of an asynchronous computation

异步计算结果的表示

QFutureSynchronizer
Convenience class that simplifies QFuture synchronization

简化QFuture 的同步

QFutureWatcher
Allows monitoring a QFuture using signals and slots

使用信号和槽监控QFuture对象

QMutex
Access serialization between threads

(实现)线程间的序列化

QMutexLocker
Convenience class that simplifies locking and unlocking mutexes

方便的类,简化了上锁/解锁操作

QReadLocker
Convenience class that simplifies locking and unlocking read-write locks for read access

方便的类,简化了读权限的上锁/解锁操作

QReadWriteLock
Read-write locking

读写锁

QRunnable
The base class for all runnable objects

所有Runnable对象的基类

QSemaphore
General counting semaphore

通用信号量计数器

QThread
Platform-independent way to manage threads

(提供)平台无关的方法管理线程

QThreadPool
Manages a collection of QThreads

(线程池)管理QTheads的集合

QThreadStorage
Per-thread data storage

每个线程的数据存储

QWaitCondition
Condition variable for synchronizing threads

同步线程用的条件变量

QWriteLocker
Convenience class that simplifies locking and unlocking read-write locks for write access

方便的类,简化了用于写权限的上锁/解锁操作

QtConcurrent
High-level APIs that make it possible to write multi-threaded programs without using low-level threading primitives

高级API,便于实现多线程程序而告别底层线程原语

注意:QT中的线程类以本地线程API实现。例如:Win32和pthreads,因此,这些线程类可以和本地API协同工作。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: