Oh, I wasn’t thinking that this was something new in Juce. I’m baffled as to what I could have done to cause this, however.
I never call stopThread at any time in my code - instead, my loops all check threadShouldExit() rather obsessively and terminate if that becomes true. I generally feel that that’s the only correct way to exit a thread, in any language.
The stack trace only seems to show ONE thread locked. Yes, I know that seems implausible. I am quite sure, however, that only one of MY threads is locked waiting for this. Is there any other way to lock the MessageManager other than creating an instance of MessageManagerLock?
As I mentioned, I set breakpoints in MessageManagerLock’s constructors. I reach a breakpoint once, take and release the thread. The next time I hit that constructor, the code spins forever, waiting clearly for something to happen in some other thread that isn’t happening.
chkn: thanks for the code sample!
As for rewriting the whole app entirely, well, I need to deliver final product in a few weeks and I’ve been at this for many months. I had no issues until this redesign, which unfortunately was somewhat too large for me to isolate which specific part might have triggered it.
But I think I will start putting things to derive from AsyncUpdater, now I know how risky doing anything component-oriented is on any other thread. In fact, I’m now believing that EVERY use of MessageManagerLock is a potential problem, am I right?
I’m a little worried by that code sample, actually, because I can’t see how it works correctly. You’re checking asyncUpdateHasProceeded repeatedly - and yet you never take a lock. If some other thread changes asyncUpdateHasProceeded, then you aren’t guaranteed to see that change until you take some sort of mutex.
Also, why use Thread::sleep instead of Thread::wait? I always use wait, so that I can then notify the thread and avoid all those nasty 100ms loops that result in sluggish UI response - or, does notify work on sleeping threads too? I am realizing that I’m not sure of the difference between Thread::sleep() and Thread::notify().
Thanks as always for the support. I’ll report back when I hit a solution so the “next guy” will be able to search it up.