[Qt-interest] please help me with this problem
Yifei Li
yifli at mtu.edu
Tue Dec 8 03:36:34 CET 2009
----- Original Message -----
From: "Glenn Hughes" <ghughes02138 at gmail.com>
To: qt-interest at trolltech.com
Sent: Monday, December 7, 2009 8:58:29 PM GMT -05:00 US/Canada Eastern
Subject: Re: [Qt-interest] please help me with this problem
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...
Both of the sender and the receiver live in the main thread (they are created in the main thread).
the signal displayMessage(QString) is emitted from my worker thread to the main thread, and I use direct connection
> 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.
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list