In the following, we will briefly describe implementations of basic concurrency concepts, starting with the most important of them, namely threads.
Threading support classes in Qt
Threads
The class that offers a thread abstraction in Qt is unsurprisingly named QThread. We start an OS thread by subclassing the QThread class in the following manner:
class MyThread : public QThread
{
public:
void run()
{
// thread working...
}
};
Then, we instantiate this class and call its start() method. This will start a new OS thread instance and execute the run() method in this new thread's context. The second possibility is not to subclass the QThread but just to call its start() method, which will in turn start its event loop...