【发布时间】:2013-09-17 09:03:59
【问题描述】:
是否可以通过关联的 QFuture 对象来停止线程? 目前我一直在开始这样的视频捕捉过程。
this->cameraThreadRepresentation = QtConcurrent::run(this,&MainWindow::startLiveCapturing);
在 startLiveCapturing-Method 内部,一个无限循环正在运行,用于捕获图像并显示它们。因此,如果用户想要停止该过程,他只需按下一个按钮,该操作就会停止。 但似乎我不能通过调用这样的取消方法来停止这个线程?
this->cameraThreadRepresentation.cancel();
我做错了什么以及如何停止该线程或操作。
【问题讨论】:
标签: multithreading qt qtconcurrent