[Qt-interest] QThread eventloop problems
Jason H
scorp1us at yahoo.com
Thu Feb 25 20:25:10 CET 2010
I have no idea why would want to load pages in a thread when the Qt networking classes are async. I'd keep them all in the main thread. There is only a small performance hit on the one CPU having all the IO loaded on it. Unless you're doing a lot of SSL, it shouldn't matter.
________________________________
From: Sergey Shekyan <sergio_arm at yahoo.com>
To: qt-interest at trolltech.com
Sent: Thu, February 25, 2010 12:50:20 PM
Subject: [Qt-interest] QThread eventloop problems
Hi,
I am trying to have multithreaded app with QWebPage isntance in every thread.
the way I am creating it is:
void
MyServer::incomingConnection(int socketDescriptor)
{
MyThread* thread = new MyThread(this, socketDescriptor);
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
thread->start();
}
and run() of MyThread is:
void
MyThread::run(){
MyPage page(sockfd);
exec();
}
where, MyPage is subclassed from QObject, and has QWebPage member pointer, and slots to handle signals from QWebPage.
So the problem is everything works if I am creating MyPage in main event loop, and looks like I don't have the event loop, and no signals of QWebPage are triggered if MyPage is in MyThread.
What am I doing wrong?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100225/58d02618/attachment.html
More information about the Qt-interest-old
mailing list