[Interest] QThread & sleep on QMutex

Matthew Woehlke mwoehlke.floss at gmail.com
Thu Jul 30 19:01:27 CEST 2015

On 2015-07-30 01:43, Igor Mironchik wrote:
> On 30.07.2015 00:06, Matthew Woehlke wrote:
>> Why are you doing this? If the intent is just to make the thread sleep,
>> why not use QThread::msleep?
> Because in Qt 4 QThread::sleep is protected.

You failed to mention that you are using Qt 4.x :-).

If you *need* to sleep, I'd go with Tony's solution; just derive some
class from QThread and "unprotect" the relevant methods. I've done this
in my own projects.

You don't need to know what thread you're in; sleep() and friends are
static methods. Just write:


That said, see also Keith and Thiago's replies :-).


More information about the Interest mailing list