On Thursday, September 29, 2011 15:05:56 Steven Schveighoffer wrote: > If all the data the calculated value depends on is immutable, then the two > threads loading the value at the same time will be loading the same > value. If you're writing a 42 to an int from 2 threads, there is no > deadlock or race issue. Writing a 42 over a 42 does not cause any > problems.
An excellent point, but that's assuming that the data being used is all immutable, and that particular stipulation was not given previously. But if that stipulation is there, then you're right. Otherwise, the locking is still needed. - Jonathan M Davis