TRentrantRWlock thread lock, program freezes

Thanks so much.

(gdb) print ((ROOT::TReentrantRWLock<std::mutex, ROOT::Internal::RecurseCounts> * const)ROOT::gCoreMutex)->fMutex
A syntax error in expression, near `const)ROOT::gCoreMutex)->fMutex'.

The above does not work.

print (ROOT::gCoreMutex)
$1 = (class ROOT::TVirtualRWMutex *) 0x5555569d5550
(gdb) info threads
  Id   Target Id                                   Frame 
* 1    Thread 0x7ffff4961b80 (LWP 427777) "runGUI" futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x5555569d55bc) at ../sysdeps/nptl/futex-internal.h:183
  2    Thread 0x7fffe404c700 (LWP 427808) "runGUI" 0x00007ffff6d98aff in __GI___poll (fds=0x7fffe4046a80, nfds=2, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
  3    Thread 0x7ffee3827700 (LWP 427809) "runGUI" futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x555557b9600c) at ../sysdeps/nptl/futex-internal.h:183
(gdb) thread apply all bt

Thread 3 (Thread 0x7ffee3827700 (LWP 427869)):
#0  futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x555557a0d8ac) at ../sysdeps/nptl/futex-internal.h:183
#1  __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x555557ba0990, cond=0x555557a0d880) at pthread_cond_wait.c:508
#2  __pthread_cond_wait (cond=0x555557a0d880, mutex=0x555557ba0990) at pthread_cond_wait.c:638
#3  0x00007ffff63c6ed1 in TPosixCondition::Wait (this=0x555557a0d870) at /opt/root_src/core/thread/src/TPosixCondition.cxx:65
#4  0x00007ffff63c4a92 in TThread::XARequest (xact=0x7ffff63d2200 "PRTF", nb=2, ar=0x7ffee3821310, iret=0x0) at /opt/root_src/core/thread/src/TThread.cxx:1061
#5  0x00007ffff63c4449 in TThread::Printf (fmt=0x7ffff7fa7106 "Stop:  %s") at /opt/root_src/core/thread/src/TThread.cxx:950
#6  0x00007ffff7f26439 in RThread::Stop (this=0x55555718c468) at /home/user/zdt-daq/gui/RThread.cpp:121
#7  0x00007ffff7f3a5df in MainWindow::DoStopDAQ (this=0x7ffffffdd590) at /home/user/zdt-daq/gui/MainWindow.cpp:1715
#8  0x00007ffff7f371d4 in MainWindow::SaveAndExit (this=0x7ffffffdd590) at /home/user/zdt-daq/gui/MainWindow.cpp:1206
#9  0x00007ffee2f2502a in ?? ()
#10 0x0000000000000000 in ?? ()

Thread 2 (Thread 0x7fffe404c700 (LWP 427868)):
#0  0x00007ffff6d98aff in __GI___poll (fds=0x7fffe4046a80, nfds=2, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007fffe408b1a2 in ?? () from /lib/x86_64-linux-gnu/libusb-1.0.so.0
#2  0x00007ffff71cb609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#3  0x00007ffff6da5293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 1 (Thread 0x7ffff4961b80 (LWP 427837)):
#0  futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x5555569d55b8) at ../sysdeps/nptl/futex-internal.h:183
#1  __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x5555569b1060, cond=0x5555569d5590) at pthread_cond_wait.c:508
#2  __pthread_cond_wait (cond=0x5555569d5590, mutex=0x5555569b1060) at pthread_cond_wait.c:638
#3  0x00007ffff70b1e50 in std::condition_variable::wait(std::unique_lock<std::mutex>&) () from /lib/x86_64-linux-gnu/libstdc++.so.6
#4  0x00007ffff63b31ab in std::_V2::condition_variable_any::wait<std::unique_lock<std::mutex> > (this=0x5555569d5590, __lock=...) at /usr/include/c++/9/condition_variable:273
#5  0x00007ffff63b1df4 in std::_V2::condition_variable_any::wait<std::unique_lock<std::mutex>, ROOT::TReentrantRWLock<std::mutex, ROOT::Internal::RecurseCountsTBBUnique>::WriteLock()::{lambda()#1}>(std::unique_lock<std::mutex>&, ROOT::TReentrantRWLock<std::mutex, ROOT::Internal::RecurseCountsTBBUnique>::WriteLock()::{lambda()#1}) (this=0x5555569d5590, __lock=..., __p=...) at /usr/include/c++/9/condition_variable:282
#6  0x00007ffff63adb8b in ROOT::TReentrantRWLock<std::mutex, ROOT::Internal::RecurseCountsTBBUnique>::WriteLock (this=0x5555569d5558) at /opt/root_src/core/thread/src/TReentrantRWLock.cxx:190
#7  0x00007ffff63bc736 in ROOT::TRWMutexImp<std::mutex, ROOT::Internal::RecurseCountsTBBUnique>::WriteLock (this=0x5555569d5550) at /opt/root_src/core/thread/src/TRWMutexImp.cxx:42
#8  0x00007ffff771d55b in ROOT::TVirtualRWMutex::Lock (this=0x5555569d5550) at /home/user/builds/build-root_src-Desktop-Debug/include/TVirtualRWMutex.h:79
#9  0x00007ffff7556780 in TQConnection::LockSlot (this=0x555557490ff0) at /opt/root_src/core/base/src/TQConnection.cxx:664
#10 0x00007ffff7556bf0 in TQConnection::SendSignal (this=0x555557490ff0) at /opt/root_src/core/base/inc/TQConnection.h:71
#11 0x00007ffff7f2866a in TQObject::EmitVA<>(char const*, int) (this=0x7ffffffdd8e0, signal_name=0x7ffff7dfb9d3 "Timeout()") at /home/user/builds/build-root_src-Desktop-Debug/include/TQObject.h:137
#12 0x00007ffff7f9713e in TQObject::Emit (this=0x7ffffffdd8e0, signal=0x7ffff7dfb9d3 "Timeout()") at /home/user/builds/build-root_src-Desktop-Debug/include/TQObject.h:173
#13 0x00007ffff7c2b643 in TTimer::Timeout (this=0x7ffffffdd8d0) at /opt/root_src/core/base/inc/TTimer.h:96
#14 0x00007ffff758d5ba in TTimer::Notify (this=0x7ffffffdd8d0) at /opt/root_src/core/base/src/TTimer.cxx:145
#15 0x00007ffff758d582 in TTimer::CheckTimer (this=0x7ffffffdd8d0, now=...) at /opt/root_src/core/base/src/TTimer.cxx:132
#16 0x00007ffff76a6ad0 in TUnixSystem::DispatchTimers (this=0x5555555fe800, mode=true) at /opt/root_src/core/unix/src/TUnixSystem.cxx:2956
#17 0x00007ffff76a17f3 in TUnixSystem::DispatchOneEvent (this=0x5555555fe800, pendingOnly=false) at /opt/root_src/core/unix/src/TUnixSystem.cxx:1096
#18 0x00007ffff7577475 in TSystem::InnerLoop (this=0x5555555fe800) at /opt/root_src/core/base/src/TSystem.cxx:405
#19 0x00007ffff75771e3 in TSystem::Run (this=0x5555555fe800) at /opt/root_src/core/base/src/TSystem.cxx:355
#20 0x00007ffff74fbaaf in TApplication::Run (this=0x7ffffffdd1d0, retrn=false) at /opt/root_src/core/base/src/TApplication.cxx:1624
#21 0x000055555556b315 in main (argc=3, argv=0x7fffffffe328) at /home/user/zdt-daq/gui/main.cxx:121

I tried changing the fFlags to std::atomic. First it looked as if it worked. But then I added additional Printf statements in the Stop function, and got the freeze again (every time). So might have changed just the timing a bit of when it happened.

Thanks again.