summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/code/src_corelib_concurrent_qthreadpool.cpp
blob: 327a00ffa81576899cc626696da3cd2566733067 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
//! [0]
class HelloWorldTask : public QRunnable
{
    void run()
    {
        qDebug() << "Hello world from thread" << QThread::currentThread();
    }
}

HelloWorldTask *hello = new HelloWorldTask();
// QThreadPool takes ownership and deletes 'hello' automatically
QThreadPool::globalInstance()->start(hello);
//! [0]