From 478ed8ebced85a7b9d4bbafaed6a5cec84730074 Mon Sep 17 00:00:00 2001 From: inga-lovinde <52715130+inga-lovinde@users.noreply.github.com> Date: Sat, 12 Jun 2010 21:44:35 +0000 Subject: [PATCH] Fixed race condition in config initialization --- IISMainHandler/MainHandler.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/IISMainHandler/MainHandler.cs b/IISMainHandler/MainHandler.cs index 4752fb4..8758d1e 100644 --- a/IISMainHandler/MainHandler.cs +++ b/IISMainHandler/MainHandler.cs @@ -19,7 +19,13 @@ namespace FLocal.IISHandler { throw new HttpException(403, "You have come from the static page"); } - if(!FLocal.Common.Config.isInitialized) FLocal.Common.Config.Init(ConfigurationManager.AppSettings); + if(!FLocal.Common.Config.isInitialized) { + lock(typeof(FLocal.Common.Config)) { + if(!FLocal.Common.Config.isInitialized) { + FLocal.Common.Config.Init(ConfigurationManager.AppSettings); + } + } + } WebContext context = new WebContext(httpcontext); ISpecificHandler handler = HandlersFactory.getHandler(context);