Qt-interest Archive, July 2006
QT 4.0.1 trouble with QTimer vs2003.net
Message 1 in thread
My application creates multiple worker threads.
The worker threads send and receive messages using tcpSockets.
When waitForReadyRead times out eg:
if (!tcpxx->waitForReadyRead(TXResultsTimeout))
I try to set a timer that will cause the thread to sleep for awhile before
retrying. here's the line of code that then crashes:
MsgTimeoutClock = new QTimer(this);
I get this message:
ASSERT failure in QCoreApplication::sendEvent: "Cannot send events to
objects owned by a different thread. Current thread b59f08. Receiver '' (of
type 'SMSTransaction') was created in thread 9f79e0", file
kernel\qcoreapplication.cpp, line 275
Is it not legal to create QTimers in an object that inherits QThread? Does
the timer need to be created before I call start()?
tia
_________________________________________________________________
On the road to retirement? Check out MSN Life Events for advice on how to
get there! http://lifeevents.msn.com/category.aspx?cid=Retirement
--
[ signature omitted ]
Message 2 in thread
> I try to set a timer that will cause the thread to sleep for awhile
> before retrying. here's the line of code that then crashes:
try this for letting your thread sleep.
QThread::sleep(msec);
regards michael
--
[ signature omitted ]