I would like to lock("on some object") to block two threads of a single user to access some part of the code in the same time. Two differents users with two differents sessions can do that. I am using FormsAuthentication for handling sessions. What kind of object can I use for the lock ? Does this class (FormsAuthentication) supply some kind of singletons for each session, or do you know some other trick to do that?
I am thinking about handling a singleton hiding a dictionnary on a set of objects (as set of locks for different opened session). But before starting such complexe class that could make code less understandable, am I forgetting some best and easyer way to do that?
Do you know some better trick to do that lock for a signle session ?