Cool! I am concerned about the threading hang though;
can you attach gdb
to the hung process and execute "thread apply all bt", then post the
results? Not sure what would be different under FreeBSD vs. Linux as far
as threading is concerned, but this should give a clue at least.
Thanks!
Tim
Hi Tim!
"tqt3/examples/thread/prodcons/" is the "strage" one:
The progress bars hangs at 98%, both threads stop, and "valgrind
--tool=helgrind" says:
prodcons.cpp:334, dubiouse: associated lock is not held by any thread
examples/thread/prodcons/prodcons.cpp, ProdCons::stop(), when I comment out these 6 lines
the program works as expected:
void ProdCons::stop()
{
if (prod && prod->running()) {
prod->stop();
condition.wakeAll();
// prod->wait();
}
if (cons && cons->running()) {
cons->stop();
condition.wakeAll();
// cons->wait();
}
if ( redraw ) {
// no point in repainting these buttons so many times is we are looping...
startbutton->setEnabled(TRUE);
stopbutton->setEnabled(FALSE);
}
stopped = TRUE;
}
And at last your requested gdb output:
(gdb) thread apply all bt
[New Thread 807407000 (LWP 100617/prodcons)]
[New Thread 807406400 (LWP 100468/prodcons)]
Thread 4 (Thread 807406400 (LWP 100468/prodcons)):
#0 0x00000008040598cc in __error () from /lib/libthr.so.3
#1 0x0000000804057d8e in _pthread_cond_wait () from /lib/libthr.so.3
#2 0x0000000800c0f8db in TQThread::wait (this=0x807562a30, time=18446744073709551615) at
kernel/qthread_unix.cpp:117
#3 0x0000000000407230 in ProdCons::stop (this=0x7fffffffe650) at ntqgarray.h:76
#4 0x0000000000407470 in ProdCons::customEvent (this=0x7fffffffe650, e=0x807c289a0) at
ntqgarray.h:76
#5 0x0000000800c842e5 in TQObject::event (this=0x7fffffffe650, e=0x807c289a0) at
ntqcstring.h:61
#6 0x0000000800ccc709 in TQWidget::event (this=0x7fffffffe650, e=0x807c289a0) at
kernel/qwidget.cpp:489
#7 0x0000000800c1cf08 in TQApplication::internalNotify (this=0x7fffffffe5c0,
receiver=0x7fffffffe650, e=0x807c289a0)
at ntqcstring.h:61
#8 0x0000000800c1c699 in TQApplication::notify (this=0x7fffffffe5c0,
receiver=0x7fffffffe650, e=0x807c289a0) at ntqcstring.h:61
#9 0x0000000800c1b815 in TQApplication::sendEvent (receiver=0x7fffffffe650,
event=0x807c289a0) at ntqcstring.h:61
#10 0x0000000800c1e1b4 in TQApplication::sendPostedEvents (receiver=0x0, event_type=0) at
ntqcstring.h:61
#11 0x0000000800c1dedf in TQApplication::sendPostedEvents () at ntqcstring.h:61
#12 0x0000000800beeff4 in TQEventLoop::processEvents (this=0x80743de20, flags=4) at
kernel/qeventloop_x11.cpp:82
#13 0x0000000800c3255c in TQEventLoop::enterLoop (this=0x80743de20) at
kernel/qeventloop.cpp:115
#14 0x0000000800c3242d in TQEventLoop::exec (this=0x80743de20) at
kernel/qeventloop.cpp:115
#15 0x0000000800c1d0b9 in TQApplication::exec (this=0x7fffffffe5c0) at ntqcstring.h:61
#16 0x00000000004075ca in main (argc=1, argv=0x7fffffffe800) at ntqgarray.h:76
Thread 3 (Thread 807407000 (LWP 100617/prodcons)):
#0 0x00000008040598cc in __error () from /lib/libthr.so.3
#1 0x00000008040547f4 in pthread_mutex_destroy () from /lib/libthr.so.3
#2 0x0000000800fa629c in TQRealMutexPrivate::lock (this=0x80752ca80) at
tools/qmutex_unix.cpp:126
#3 0x0000000800fa653f in TQMutex::lock (this=0x8074ec6b0) at tools/qmutex_unix.cpp:126
#4 0x0000000800bf00fa in TQMutexLocker::TQMutexLocker (this=0x7fffffbfdeb0,
m=0x8074ec6b0) at gthr-default.h:218
#5 0x0000000800c1e964 in TQApplication::threadTerminationHandler
(originThread=0x807562a00) at ntqcstring.h:61
#6 0x0000000800c0edc3 in TQThreadInstance::finish () at kernel/qthread_unix.cpp:117
#7 0x00000008040597a0 in __pthread_cleanup_pop_imp () from /lib/libthr.so.3
#8 0x0000000800c0ed53 in TQThreadInstance::start (_arg=0x80752ace8) at
kernel/qthread_unix.cpp:117
#9 0x000000080404e4f5 in pthread_create () from /lib/libthr.so.3
#10 0x0000000000000000 in ?? ()
Thread 2 (Thread 807407400 (LWP 100618/prodcons)):
#0 0x00000008040598ca in __error () from /lib/libthr.so.3
#1 0x00000008040547f4 in pthread_mutex_destroy () from /lib/libthr.so.3
#2 0x0000000800fa629c in TQRealMutexPrivate::lock (this=0x80752ca80) at
tools/qmutex_unix.cpp:126
#3 0x0000000800fa653f in TQMutex::lock (this=0x8074ec6b0) at tools/qmutex_unix.cpp:126
#4 0x0000000800bf00fa in TQMutexLocker::TQMutexLocker (this=0x7fffff9fceb0,
m=0x8074ec6b0) at gthr-default.h:218
#5 0x0000000800c1e964 in TQApplication::threadTerminationHandler
(originThread=0x807562a30) at ntqcstring.h:61
#6 0x0000000800c0edc3 in TQThreadInstance::finish () at kernel/qthread_unix.cpp:117
#7 0x00000008040597a0 in __pthread_cleanup_pop_imp () from /lib/libthr.so.3
#8 0x0000000800c0ed53 in TQThreadInstance::start (_arg=0x80752ad88) at
kernel/qthread_unix.cpp:117
#9 0x000000080404e4f5 in pthread_create () from /lib/libthr.so.3
#10 0x0000000000000000 in ?? ()
(gdb) quit
The program is running. Exit anyway? (y or n)
Nik
--
Please do not email me anything that you are not comfortable also sharing with the NSA.