[Interest] QThread & sleep on QMutex

Igor Mironchik igor.mironchik at gmail.com
Thu Jul 30 11:46:40 CEST 2015


Hi,

On 30.07.2015 11:31, Tony Rietwyk wrote:
> Igor wrote:
>
>> Because in Qt 4 QThread::sleep is protected.
> You can unprotect it by deriving your own class from QThread and making
> whichever static methods public!  As long as you are aware of the pitfalls
> (don't sleep in main thread, etc.), and much easier than messing with locks
> just to gain access to sleep.

Thank you guys for your answers. You are right and I know about all this 
approaches.

But I have to say that sleep() needed in object that doesn't know 
anything about his thread.

And my question is just theoretical: is this approach good or such 
sleep() implementation not so good and why? I.e. will such sleep() 
release processor's time for another thread or not?

-- 
Best Regards,
Igor Mironchik.




More information about the Interest mailing list