While looking into double-checked locking I’ve seen numerous recommendations to just skip the first check and immediately go for the lock and just check after taking it instead.
This lead me to wonder, is lock (this.padlock) “cheap” when uncontended?
We can test it…
I get:
Code: