0
我有一个问题。如果我调用Abort(),运行函数将返回没有complexMath实例的时间有足够时间进行清理。在调用quit()后清理QThread
我想要的是,在调用Abort()之后,complexMath实例有足够的时间关闭它自己,在它返回之前清除所有待处理的信号和插槽(在complexMath中,它也有它自己的信号和插槽)。
void MyThread::Go(){
start();
}
void MyThread::Abort(){
emit stopNow();
quit();
}
void MyThread::run(){
ComplexMath * complexMath = new ComplexMath();
connect(complexMath, SIGNAL(OnCalculation(qint)), this, SLOTS(PartialOutput(qint)));
connect(this, SIGNAL(stopNow()), complexMath, SLOTS(deleteLater());
exec();
}
void MyThread::PartialOutput(qint data){
qDebug() << data;
}
谢谢!