线程和并发编程范例

Qt makes it easy to write multithreaded applications. Signals and slots can be used to safely communicate between threads in your application.

Mandelbrot

Mandelbrot example demonstrates multi-thread programming using Qt. It shows how to use a worker thread to perform heavy computations without blocking the main thread's event loop

使用信号量的生产者和消费者

Producer and Consumer using Semaphores example shows how to use QSemaphore to control access to a circular buffer shared by a producer thread and a consumer thread

使用等待条件的生产者和消费者

Producer and Consumer using Wait Conditions example shows how to use QWaitCondition and QMutex to control access to a circular buffer shared by a producer thread and a consumer thread

队列自定义类型

Queued Custom Type example shows how to send custom types between threads with queued signals and slots

The QtConcurrent namespace includes a collection of classes and functions for straightforward concurrent programming.

These examples show how to apply the basic techniques of concurrent programming to simple problems.

Image Scaling

演示如何异步下载和比例缩放图像

Prime Counter

Demonstrates how to monitor the progress of concurrent operations

Word Count

演示如何使用 map-reduce (映射缩减) 算法

Examples marked with an asterisk (*) are fully documented.