I have an ASP.NET application in which I write this code in the Application_OnStart event:
public virtual void OnStart(HttpApplication httpApplication) { MyClass.PopulateIndices(); }
Now I know that App_Onstart
launched only once, so my question is: I need to add thread safety to this code, for example:
lock(some object) { MyClass.PopulateIndices(); }
Is this really lock()
? Can multiple threads run the OnStart
application at the same time?
source share