default random object?
Walter Bright
newshound1 at digitalmars.com
Sat Feb 14 10:10:21 PST 2009
grauzone wrote:
> I don't understand this. If implemented right (D2.0 or gcc thread
> variables), TLS can be as fast as a normal global variable. You only
> need an additional check (a simple if()) to lazily initialize the RNG.
That's the notorious double-checked-locking bug, an incredibly seductive
pattern that is wrong and very illustrative about how hard it is to do
multithreaded programming correctly.
http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html
More information about the Digitalmars-d
mailing list