I have an ASP.NET application in which I am writing this code in Application_OnStart event:
public virtual void OnStart(HttpApplication httpApplication)
{
MyClass.PopulateIndices();
}
Now, I know that App_Onstart
is fired only once, so my question is: do I need to add thread safety in this code, like:
lock(some object)
{
MyClass.PopulateIndices();
}
Is this lock()
really needed? Can multiple threads fire App OnStart
simultaneously?