void Thread::run()
{
while(stopped)
{
{
msleep(500);
mutex.lock();
strTmp = QString::fromStdString(myCom->readAll().toStdString());
temp.append(strTmp);
cnt +=1;
qDebug() << cnt << ":" <<this->currentThreadId();
mutex.unlock();
}
//把接受到的数据发给主线程
emit this -> serialFinished(strTmp);
}
}
这段是子线程接收串口传过来的数据,问题是如果再创建一个线程用于解析数据,那么子线程中接受到的数据(strTmp)变量怎么传输给另一个子线程呢? |