qt 未来 isRunning() 与 isStarted()
qt future isRunning() vs isStarted()
它们有什么区别?从文档中,它说 "currently running" vs "has been started"?
比如两个线程,一个是main,另一个叫A。
如果当前,main是运行,A启动了一次()。请问A.isRunning()
return 是假的吗? A.isStarted()
return 会吗?
如果 A 永远不会启动怎么办?
文档可能更清晰。通过阅读源代码我可以看到它进入 Started
状态 once, when the function is first run, and that flag doesn't get cleared (even if task is cancelled). So A.isStarted()
should return true
. isRunning()
however is the actual current state, which depends on current progress (eg. !isFinished()
), or is false
for example if it was paused or cancelled (or caught an exception).
它们有什么区别?从文档中,它说 "currently running" vs "has been started"?
比如两个线程,一个是main,另一个叫A。
如果当前,main是运行,A启动了一次()。请问A.isRunning()
return 是假的吗? A.isStarted()
return 会吗?
如果 A 永远不会启动怎么办?
文档可能更清晰。通过阅读源代码我可以看到它进入 Started
状态 once, when the function is first run, and that flag doesn't get cleared (even if task is cancelled). So A.isStarted()
should return true
. isRunning()
however is the actual current state, which depends on current progress (eg. !isFinished()
), or is false
for example if it was paused or cancelled (or caught an exception).