zoukankan      html  css  js  c++  java
  • Qt532.线程(_beginthread)

    1、(20180928)环境:Win7x64、Qt5.3.2 MSVC2010 OpenGL、ms2010

    2、测试代码:

      ZC:我记得 之前在 VC6、vs08 上,还要选择 使用的是哪种 运行时线程DLL(Debug / Release / ...)

      ZC:但是,这里 使用Qt时什么都没有设置,".pro"文件里面 都是默认生成的信息,没有手动添加任何东西...

     ZC:下面的测试,是在 Release下执行得到的结果:

      2.1、thread_z.cpp

    #include "thread_z.h"
    
    #include <QDebug>
    
    #include <Windows.h>
    #include <process.h>
    
    
    void Thread_RECV(void *_ArgList)
    {
        qDebug() << "Thread_RECV(...) in";
    
        /* _endthread given to terminate */
        _endthread();
    }

      2.2、MainWindow.cpp

    #include "MainWindow.h"
    #include "ui_MainWindow.h"
    
    #include <process.h>
    
    #include "thread_z.h"
    
    
    MainWindow::MainWindow(QWidget *parent) :
        QMainWindow(parent),
        ui(new Ui::MainWindow)
    {
        ui->setupUi(this);
    }
    
    MainWindow::~MainWindow()
    {
        delete ui;
    }
    
    void MainWindow::on_pbtnRecvMsgClear_clicked()
    {
        _beginthread(Thread_RECV, 0, NULL);
    }

      2.3、ZC:点了几下按钮,控制台有输出信息:

    Thread_RECV(...) in
    Thread_RECV(...) in
    Thread_RECV(...) in
    Thread_RECV(...) in
    Thread_RECV(...) in

    3、

    4、

    5、

  • 相关阅读:
    hdu4549 M斐波那契数列(矩阵快速幂+费马小定理)
    E. 因数串(EOJ Monthly 2020.7 Sponsored by TuSimple)
    2019春总结作业
    大一下半年学期总结
    ball小游戏
    贪吃蛇
    链接远程仓库
    git自动上传脚本及基本代码
    模板 --游戏
    飞机小游戏
  • 原文地址:https://www.cnblogs.com/cppskill/p/9718587.html
Copyright © 2011-2022 走看看