 ———————多线程的使用(QT方式)———————
 ———————多线程的使用(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();
 ———————代码获取查看下方———————
 ———————代码获取查看下方———————



















