Multiple threads in a single class
Hi,
I want to write a QObject derived class which should contain two threads. Each thread should run a different function of my class (endless loops).
I am confused which is the right and easiest way (subclassing QThread, using QThread directly, movetothread(), QtConcurrent:run).
Can someone give me a smal example?
Best regards,
Matthias
Re: Multiple threads in a single class
If you really need an endless loop then subclassing QThread and reimplementing run() is the way to go. But it might be that you only think you need an endless loop in which case other approaches are viable as well.
Re: Multiple threads in a single class
Its all about coherence. If you want multiple classes to do your job, running multiple threads for it, make sure that each and every class is coherent enough otherwise you've minimized reuse........