main.cpp
int main() { MyThread a; MyThread b; a.start(); b.start(); a.wait(); b.wait(); }mythread.h
class MyThread : public QThread { public: virtual void run(); };
mythread.cpp
本文展示了一个使用C++和Qt库实现的简单多线程程序。该程序创建了两个继承自QThread的线程,并在运行期间每秒打印消息,演示了线程启动、等待的基本操作。
main.cpp
int main() { MyThread a; MyThread b; a.start(); b.start(); a.wait(); b.wait(); }mythread.h
class MyThread : public QThread { public: virtual void run(); };
mythread.cpp
228

被折叠的 条评论
为什么被折叠?