[Interest] QThread and sleep

Hugo Drumond Jacob hugo at jacob.eng.br
Tue Mar 19 18:56:47 CET 2013


2013/3/19 Thiago Macieira <thiago.macieira at intel.com>:
> 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)?

No problem! In fact, we are using! :D It's just a question about
QThread::wait and QThread::sleep: "It's safe use QThread::wait in
other situation that not synchronously QThread::terminate ?" and you
already answered: yes. Maybe not for this point of our application in
specific, but is normal usage.

>
> --
> Thiago Macieira - thiago.macieira (AT) intel.com
>   Software Architect - Intel Open Source Technology Center
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>



More information about the Interest mailing list