Earlier quoted context omitted.
But that's just a different example to the one you gave before. In your previous example acquiring the explicit lock always came before the start of synchronised block, both before and after the rewrite. You've changed it here so it's a different question.
Sorry, I meant to write: synchronized(this) { a = AcquireLock(); for(c = 0; c which is inline with what the blog post was proposing. To repeat the blog is a question: for (...) { synchronized (obj) { // something } } …could it optimize into this? synchronized (this) { for (...) { // something } } My answer to that is in general, no.
Because '...' can include arbitrary side-effect inducing statements that can't be moved around without affecting the behavior. As the poster discovered.