[Qt-interest] QThread event loop running in main thread?

Thiago Macieira thiago at kde.org
Tue Dec 28 22:25:24 CET 2010


On Tuesday, 28 de December de 2010 13:03:08 Mihail Naydenov wrote:
> > Using  signals in a class derived from QThread isn't wrong. It's just a
> > concept 
> > 
> > violation. A signal called "workDone" means the job is done, not that
> > the  thread is done. Otherwise, you could just use the
> > "finished"  signal.
> 
> I agree with "concept  violation", still, if you know what are you doing, 
> moveToThread(this) gives you 
> 
> the simples possible framework. That was the argument all about.

No.

I called:
 signals - concept violation
 slots - probably an error
 moveToThread(this) - forbidden

Violating the encapsulation is a bad thing, but it's forgivable and, if done 
right, can work. Using slots is probably wrong, because you usually expect 
them to be run in the thread you started, when they don't.

moveToThread(this) is never right. It does more than what you think it does.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101228/77815355/attachment.bin 


More information about the Qt-interest-old mailing list