QThread 好象自身无法暂停(睡眠),然后再恢复(唤醒)?
只能重新创建一个 QThread 对象?
有什么更直接的简单办法吗?
------解决方案--------------------
QThread::sleep
------解决方案--------------------
The QWaitCondition class provides a condition variable for synchronizing threads.
QWaitCondition allows a thread to tell other threads that some sort of condition has been met. One or many threads can block waiting for a QWaitCondition to set a condition with wakeOne() or wakeAll(). Use wakeOne() to wake one randomly selected condition or wakeAll() to wake them all.
我猜测Qt之所以不使用resume和suspend多少是因为参考了java里的Thread的resume和suspend(java里这2个方法已经不被建议使用了-deprected),使用resume和suspend有“死锁倾向”
------解决方案--------------------
有的,
pImageThread->terminate();//线程中止
pImageThread->wait();//中止的线程并不能立即停止,等待期完全中止
pImageThread->start();//重新启动线程