[Interest] Which thread implementation is best to trigger external library via timers
K. Frank
kfrank29.c at gmail.com
Thu Apr 10 18:17:15 CEST 2014
Hi Thiago!
On Thu, Apr 10, 2014 at 11:13 AM, Thiago Macieira
<thiago.macieira at intel.com> wrote:
> Em qui 10 abr 2014, às 09:42:25, Roland Winklmeier escreveu:
>> 1. Subclassing QThread: I've read you should avoid that, so I don't really
>> consider it
>> 2. Move it to thread: networkWorker->moveToThread(thread);
>> 3. High level API's: QtConcurrent/QRunning
>>
>> The requirements are:
>> - Run infinite - stop only when requested
>> - Needs to run threads event loop
>> - Able to call slots via queued events
>> and the most critical part
>> - direct function calls synchronized via Mutexes from main thread
>
> Go for option 1:
>
> void ThreadClass::run()
> {
> forever {
> DoTask();
> sleep(1);
> }
> }
But Thiago -- You, of all people! -- How's he then going to get his
queued-event slot calls to run in the worker thread unless he calls
ThreadClass::moveToThread (this) ?!!?
> It's horrible, but not because of QThread.
> --
> Thiago Macieira - thiago.macieira (AT) intel.com
> Software Architect - Intel Open Source Technology Center
Happy Multi-Threaded Hacking!
K. Frank
More information about the Interest
mailing list