[Interest] QThread and sleep

Thiago Macieira thiago.macieira at intel.com
Tue Mar 19 18:45:15 CET 2013


On terça-feira, 19 de março de 2013 14.14.20, Hugo Drumond Jacob wrote:
> > Yes: don't sleep.
> 
> In fact, we have a class inherited of QThread that can change the
> default scheduler of thread to use Linux SCHED_FIFO and really change
> the thread priority. We are using that way because we need to
> manipulate some GPIO pins with more resolution than QTimer ( in order
> of micro seconds ). So, "the best" way ( understand more quickly way )
> to solve this is using sleep. Only for knowledge: some delay of kernel
> context switching don't affect our application of GPIO pins and we
> trying to avoid PREEMPRT patch.

If you're doing timing sensitive code with resolution better than QTimer, and 
you have platform-specific code to place your thread in FIFO real-time 
priority, what's the problem with using platform-specific nanosleep(2)?

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130319/d5b0f1cc/attachment.sig>


More information about the Interest mailing list