Date: 2007-04-11 11:26 pm (UTC)
I'd say that the bug and the idiom are independent. Having 'synchronized' without 'volatile' obviously was an idiocy, but why should I bother writing explicit synchronization incantations and runtime hints to initialize a singleton if the runtime already provides the mechanism. IBM (linked by [livejournal.com profile] upstartn) says the same thing:


Instead of double-checked locking, use the Initialize-on-demand Holder Class idiom, which provides lazy initialization, is thread-safe, and is faster and less confusing than double-checked locking[.]
This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

Profile

juan_gandhi: (Default)
Juan-Carlos Gandhi

May 2025

S M T W T F S
    1 2 3
456 7 8 9 10
11 121314151617
181920 21 222324
25 262728 293031

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated May. 31st, 2025 03:03 pm
Powered by Dreamwidth Studios