JavaMemoryModel: Re: "Design Pattern: Singleton in C#" is dangerously flawed

From: Bill Pugh (
Date: Mon Jul 29 2002 - 14:54:01 EDT

I'm sorry, you are correct. I didn't notice that you had declared
MTSingleton to be volatile. Sorry about that.

But doesn't depending on static initialization just work?


At 11:39 AM -0700 7/29/02, Pedro Silva wrote:
>Thanks for you comment, but I believe this will work in C#. As it
>says in the article you linked to below, "The consensus proposal
>extends the semantics for volatile so that the system will not allow
>a write of a volatile to be reordered with respect to any previous
>read or write, and a read of a volatile cannot be reordered with
>respect to any following read or write."
>While that may not work correctly in the JVM, that is the way
>volatile is implemented in the .NET Framework. At least, that's the
>description I read in the C# programmer's reference for the volatile
>- Pedro
JavaMemoryModel mailing list -

This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:40 EDT