使用公共线程池的例子(QtSDK helloworld )
来源:互联网 发布:靠谱的淘宝优惠券软件 编辑:程序博客网 时间:2024/04/30 02:14
#include <QtCore>
// A hello world program to demonstrate the use of the global thread pool
// hellothreadpool/main.cpp
class Work : public QRunnable
{
public:
void run()
{
qDebug() << "Hello from thread " << QThread::currentThread();
}
};
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
Work work;
work.setAutoDelete(false);
QThreadPool *threadPool = QThreadPool::globalInstance(); //使用公共线程池
threadPool->start(&work);
qDebug() << "hello from GUI thread " << QThread::currentThread();
threadPool->waitForDone();
return 0;
}
// A hello world program to demonstrate the use of the global thread pool
// hellothreadpool/main.cpp
class Work : public QRunnable
{
public:
void run()
{
qDebug() << "Hello from thread " << QThread::currentThread();
}
};
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
Work work;
work.setAutoDelete(false);
QThreadPool *threadPool = QThreadPool::globalInstance(); //使用公共线程池
threadPool->start(&work);
qDebug() << "hello from GUI thread " << QThread::currentThread();
threadPool->waitForDone();
return 0;
}
- 使用公共线程池的例子(QtSDK helloworld )
- 使用线程池例子
- 线程池使用例子
- 使用boost线程池很好的例子
- 使用java线程池的一个例子
- NDK的Helloworld例子
- JNI HelloWorld的例子
- MyBatis使用接口映射的简单HelloWorld小例子
- 线程池helloworld
- android 多线程 - 线程池 Executors.newFixedThreadPool 的使用例子
- android 多线程 - 线程池 Executors.newFixedThreadPool 的使用例子
- 通过线程池使用多线程并发:ThreadPoolTaskExecutor 的应用例子
- 信号的转发 QSignalMapper,mutex 和waitcondition的使用(QtSdk--threads/movedobject)
- JavaMail的一个HelloWorld例子
- 使用mutex+waitcomdition的形式来多线程通信(QtSDK examples)
- 使用QtSdk为symbian操作系统编写程序
- 使用Event同步线程的小例子
- 在线程中使用定时器的例子!
- 图形验证码的生成和破解
- WebApp印象
- 最好的学习Apple 开发的课程
- ubuntu 安装vcs出现的问题
- 读书笔记(4)
- 使用公共线程池的例子(QtSDK helloworld )
- JAVA_split_用法
- Linux系统C语言学习总结
- D. Ball CF
- 使用QSemaphore来同步两个线程(QSDK examples)
- Makefile详解
- hdu 1171 母函数 和 DP
- CXF异常 No DestinationFactory was found for the namespace http://schemas.xmlsoap.org
- sql server 中关于Order By 在子查询嵌套中的出错的解决方法!