[Qt-interest] please help me with this problem

Glenn Hughes ghughes02138 at gmail.com
Tue Dec 8 02:58:29 CET 2009


Sleep should never block... from the man page:

"The sleep() function suspends execution of the calling thread until
    either seconds seconds have elapsed or a signal is delivered to the
    thread and its action is to invoke a signal-catching function or to ter-
    minate the thread or process."

In other words, other threads can run while one thread is sleeping.
It might however have something to do with the way that cross-thread
signals are delivered.
Its an interesting question...

> I think your problem is that sleep() blocks.  That means, the
> application actually "hangs" for 2 seconds between each sleep() with no
> chance to update the display.
>
> You should use timers instead of sleep().  See
> http://doc.trolltech.com/4.6/qtimer.html#details on how to emit signals
> with a time delay or periodically.




More information about the Qt-interest-old mailing list