I am programming with multithread. In my program, I create a thread, how to wait this thread is finish before execute continue. Please see my simple program:
#include <QApplication>
#include <QThread>
class MyThread : public QThread
{
public:
MyThread();
void run();
};
MyThread::MyThread() : QThread()
{
}
void MyThread::run()
{
qWarning("Thread running.");
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
MyThread *thread = new MyThread;
thread->start();
qWarning("Output this line after thread finished.");
return 1;
}
Please modify my program to it output:
Thread running.
Output this line after thread finished.
Thanks a lot.
Bookmarks