Beispiel #1
0
 public void CreateInstancesSingletonLock2()
 {
     Parallel.For(0, 1_000_000, instance =>
     {
         SingletonLock2.GetInstance();
     });
 }
 public static SingletonLock2 GetInstance()
 {
     if (myInstance == null)
     {
         lock (myLock)
         {
             if (myInstance == null)
             {
                 myInstance = new SingletonLock2();
             }
         }
     }
     return(myInstance);
 }