[Interest] QThread & sleep on QMutex
Thiago Macieira
thiago.macieira at intel.com
Thu Jul 30 02:58:22 CEST 2015
On Wednesday 29 July 2015 23:55:30 Igor Mironchik wrote:
> Hi,
>
> I hope that in this list I will find experts of synchronization and so on.
>
> My question: is it good to make thread's sleep on mutex like this?
No.
>
> QMutex mutex;
> mutex.lock();
> mutex.tryLock( int msecs ); // This will make sleep for the given timeout.
>
> Or it's not so good idea because thread will not release processor... Or
> processor will be released? Or something else?
Because you should not sleep.
Don't make your code slower. Just finish your task.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
More information about the Interest
mailing list