有什么办法可以知道它已经完成了多少个作业?例如为什么没有像QThreadPool::jobQueueSize()
或QThreadPool::finishedJobCount()
或QThreadPool::waitingJobCount()
这样的方法。QThreadPool :: jobQueueSize()? QThreadPool :: finishedJobCount()
我看到QRunnable
s提供任何这样的功能。像started()
或finished()
我应该做一个像这样的黑客。在QRunnable::run()
/**
* Assuming _controller has a link to all the Runnables. and I've a finite number of QRunnables that I recycle in my own Way.
*/
void MyRunnable::run(){
mutex.lock();
_controller->markAsStarted(this);
mutex.unlock();
....
mutex.lock();
_controller->markAsFinished(this);
mutex.unlock();
}