Browse Source

Update Application.cs

reimplemented Double-check lock.
Single-check lock doesn't prevent from multi-initialization.
Grigory Perepechko 12 years ago
parent
commit
c2ab5f2457
1 changed files with 6 additions and 3 deletions
  1. 6 3
      aspnet/src/Application.cs

+ 6 - 3
aspnet/src/Application.cs

@@ -18,8 +18,11 @@ namespace Benchmarks.AspNet
             {
             {
                 lock (locker)
                 lock (locker)
                 {
                 {
-                    Start();
-                    started = true;
+                    if (!started)
+                    {
+                        Start();
+                        started = true;
+                    }
                 }
                 }
             }
             }
         }
         }
@@ -84,4 +87,4 @@ namespace Benchmarks.AspNet
         {
         {
         }
         }
     }
     }
-}
+}