コード例 #1
0
ファイル: Program.cs プロジェクト: Iulian-Stan/DesignPatterns
 public static LoadBalancer GetLoadBalancer()
 {
     // Support multithreaded applications through
     // 'Double checked locking' pattern which (once
     // the instance exists) avoids locking each
     // time the method is invoked
     if (_instance == null)
     {
         lock (syncLock)
         {
             if (_instance == null)
             {
                 _instance = new LoadBalancer();
             }
         }
     }
     return _instance;
 }