[Mono-devel-list] What to do with TypeInitialization in case of exceptions on second attempt to access class ? Singleton pattern

Andriy G. Tereshchenko mono-list at spam.24.odessa.ua
Mon Oct 25 16:39:55 EDT 2004


> Possibly Rafael Teixeira, possibly on Rafael Teixeira wrote possibly this:
>    public static Singleton Instance  { 
>      get {
>        if  (Singleton.instance == null)
>            Singleton.instance = new Singleton();
>        return Singleton.instance; } 
>    }

This is not thread-safe. Period. 

--
Andriy G. Tereshchenko
Odessa, Ukraine 





More information about the Mono-devel-list mailing list