———————多线程的使用(QT方式)———————
两个线程都输出一些调试信息
#include "qthread.h"
class rlthread1 : public QThread
{
Q_OBJECT
public:
rlthread1(){};
rlthread1( QObject* parent = nullptr ): QThread(parent){}
void run() override
{
for (;;)
{
qDebug() << "rlxythread1";
this->sleep(1);
}
}
};
rlthread1 *my_thread;
rlthread2 *my_thread2;
my_thread = new rlthread1(this);
my_thread2 = new rlthread2(this);
my_thread->start();
my_thread2->start();
———————代码获取查看下方———————