While loop bug? Stuck on empty

This thread! Probably. Any code that goes counter to the JMM is potentially buggy. You’re asking for a code example that consistently demonstrates something that is by definition not guaranteed to be consistent! You’ll find enough examples of problematic code if you google for it. Some things may fail almost immediately, some after enough time for the JIT to really kick in (minutes or hours), some almost randomly.

It’s quite simple, really - follow the spec! :smile: