quint32 ThreadDialog::pow(quint32 x, quint32 n){ lock.lockForWrite(); //QMutexLocker locker(&mutex); quint32 res(1); for(quint32 i = 0; i < n; i++) res *= x; lock.unlock(); return res;}
threadA.setData(this, "Thread #1", 2, 30); threadB.setData(this, "Thread #2", 2, 20);
void Thread::run(){ qDebug() << nameThread << ":" << dialog->pow(x, n);}