Note that there are some explanatory texts on larger screens.

plurals
  1. POSynchronized Not Entering
    text
    copied!<p>Note: I'm not looking for workarounds; I'm sure I can find other methods if necessary. I simply feel like I'm missing something fundamental or quirky and I want to know what I'm missing. Or if there is a way to use the debugger to get more info that would be nice too. Thanks!</p> <p>I'm having an issue with use of synchronized. I'm receiving deadlock but it seems utterly impossible. I've placed print statements before each and every synchronized call, just inside each call, and just before exiting so I can see who all holds which synchronized objects. I'm finding that it will not go inside one of my synchronized calls even though no one currently holds the lock on the object. Are there some kind of quirks that I'm missing or illegal nesting operations? Here's the jist of what I am doing.</p> <p>Oh yeah, and the oddest thing is that removing the two "busyFlagObject" synchronizations makes it work fine...</p> <p>Thread 1:</p> <pre><code>public void DrawFunction() { synchronized(drawObject) { ... // Hangs here though nobody has a lock on this object synchronized(animationObject) { } } } </code></pre> <p>Thread 2:</p> <pre><code>public void AnotherFunction() { synchronized(busyFlagObject) { // Calls a function that also uses this same Synchronized call synchronized(busyFlagObject) { // Calls another function that uses another Synchronized call // Hangs here waiting for the draw function to complete which it SHOULD // be able to do no problem. synchronized(drawObject) { } // Never gets to this one assuming the Log statements don't // buffer and aren't flushed but still shouldn't be a problem anyway. synchronized(animationObject) { } } } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload