[Qt-interest] Threading Problem
Martin Schreiber
zirkelmagier at googlemail.com
Fri Apr 23 14:11:32 CEST 2010
Hi there,
i have a problem terminating my thread.
I use startEx and StopEx methods to pause the thread and the destructor for
cleaning up.
Example::~Example()
{
m_mutex.lock();
m_bCapture = false;
m_bQuit=true;
m_mutex.unlock();
m_qWaitCond.wakeAll();
wait();
}
void Example::ExStart()
{
m_mutex.lock();
m_bCapture = true;
m_mutex.unlock();
if(!isRunning())
{
start();
}
else {
m_qWaitCond.wakeAll();
}
}
void Example::ExStop()
{
m_mutex.lock();
m_bCapture = false;
m_mutex.unlock();
}
Th run-Method :
void Example::run()
{
.....
while (!m_bQuit){
m_mutex.lock();
if (m_bCapture){
... do something ....
}
else{
m_qWaitCond.wait(&m_mutex,ULONG_MAX);
}
m_mutex.unlock();
}
}
}
I'm using functions similar to these for quite a while. after switching to a
new machine the wait() call hangs infinite and the application wont
terminate .
if i omit the wait(), the application crashes and if i do a wait(500); it
terminates but i get a
"QWaitCondition: Destroyed while threads are still waiting
QThread: Destroyed while thread is still running"
message which is completly justified.
i guess there's somthing that i'm missing, maybe someone can point me onto
it...
Thanks and regards
Martin Schreiber
btw.
i'm working with VS2008SP1,QT4.6.2,Windows 7 on a Core i7 based Workstation
and i'm building a x64 Application.
Fore some weird reasons my application compiles and links ok as a 32bit
Build but it wont run. (i always get a 0xc000007b error)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100423/1b2289f0/attachment.html
More information about the Qt-interest-old
mailing list