开发者

Query related to threads in Qt

I want my application to wait indefinitely until a task g开发者_如何学运维ets completed in another thread.

How do I perform this in Qt?

On windows, we use waitforsingletonobject, but is there any alternative to this?


Waiting for threads to finish certain tasks (thread synchronization) is the job of the QWaitCondition class.


Call wait on your QThread object.


Use QtConcurrent::run. See my answer to this question. Note that the QFutureWatcher API can work in blocking (the waitForFinished method) and non-blocking (the finished signal) modes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜