bunjee
5th May 2009, 17:20
Hey there,
I've implemented a QThread.
Here is my run function:
void qkReceptor::run()
{
// A timer to avoid high CPU charge
QTimer timer;
connect(&timer, SIGNAL(timeout()), this, SLOT(onCheckStdin()), Qt::DirectConnection);
connect(this, SIGNAL(newLine(QString)), this, SLOT(onNewLine(QString)), Qt::BlockingQueuedConnection);
timer.start(100);
QThread::exec();
}
Here is my stop function:
void qkReceptor::stop()
{
QThread::quit();
QThread::wait(); // Infinite loop here
}
When calling stop from my main thread, wait blocks everything.
Why?
Thanks.
I've implemented a QThread.
Here is my run function:
void qkReceptor::run()
{
// A timer to avoid high CPU charge
QTimer timer;
connect(&timer, SIGNAL(timeout()), this, SLOT(onCheckStdin()), Qt::DirectConnection);
connect(this, SIGNAL(newLine(QString)), this, SLOT(onNewLine(QString)), Qt::BlockingQueuedConnection);
timer.start(100);
QThread::exec();
}
Here is my stop function:
void qkReceptor::stop()
{
QThread::quit();
QThread::wait(); // Infinite loop here
}
When calling stop from my main thread, wait blocks everything.
Why?
Thanks.