线程和并行编程示例
Qt 可轻松编写多线程应用程序。信号和插槽可用于在应用程序中的线程间安全通信。
Mandelbrot 示例演示了如何使用 Qt 进行多线程编程。它展示了如何使用工作线程执行繁重的计算,而不会阻塞主线程的事件循环 | |
使用 Semaphores 的生产者和消费者示例展示了如何使用 QSemaphore 来控制对生产者线程和消费者线程共享的循环缓冲区的访问。 | |
使用等待条件的生产者和消费者示例展示了如何使用 QWaitCondition 和 QMutex 控制对生产者线程和消费者线程共享的循环缓冲区的访问 | |
队列自定义类型示例展示了如何在具有队列信号和插槽的线程之间发送自定义类型 |
QtConcurrent 命名空间包含一系列用于直接并发编程的类和函数。
这些示例展示了如何将并发编程的基本技术应用于简单问题。
演示如何异步下载和缩放图像 | |
演示如何监控并发操作的进度 | |
演示如何使用 map-reduce 算法 |
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.