Subj : [.NET] Lock Object To : comp.programming.threads From : Cool Guy Date : Fri Sep 23 2005 03:01 pm In the following, is accessing /fooLock/ thread-safe? class Test { readonly object fooLock = new Object(); public void A() { lock (fooLock) { // could we read wrong value of /fooLock/ here? // do something } } public void B() { lock (fooLock) { // could we read wrong value of /fooLock/ here? // do something } } } Or must /fooLock/ be volatile? Consider that several threads, which may run Test.A() and/or Test.B(), may already be running before /fooLock/ gets assigned. If accessing it *is* thread-safe, what makes it so? The 'readonly' modifier, the fact that it's read in a 'lock' statement ... something else? .