[Qt-interest] QRunnable question

Thiago Macieira thiago at kde.org
Tue May 4 14:54:52 CEST 2010


Em Terça-feira 04 Maio 2010, às 12:43:23, Philippe escreveu:
> This should work.
> 
> Note: because of an API design flaw that Nokia does not want to admit, you
> won't be able to sleep in your QRunnable code, by using
> QThread::sleep(...) since this API is "Static protected". Or you have to
> trick the API.

We don't admit because we don't consider it a flaw.

If you're using Concurrent and runnables, you're sending jobs (the runnables) 
into a shared resource (the thread pool). Those jobs are expected to finish as 
fast as possible, which would preclude sleeping.

If you need to sleep, for whatever reason (and the only valid reason I've ever 
heard is polling hardware), you probably want a long-lived, dedicated thread. 
So not a thread pool.

-- 
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/20100504/ff0ffbee/attachment.bin 


More information about the Qt-interest-old mailing list