For locking I am using a single static object which is global to my application:
public class MvcApplication : System.Web.HttpApplication
{
public static readonly object AppLock = new object();
...
}
Using it for locking in code:
lock(MvcApplication.AppLock)
{
...
}
Let us not consider performance impact for a moment. Can I be 100% sure that I will avoid deadlock in this case?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…