Possible Duplicate:
In c# does a locked object stay locked if an exception occurs inside it?
What happens when you have code such as this
lock(myLock)
{
try{
//some code
}catch(SomeException e)
{
throw e;
}
}
Will myLock get released properly? I have a situation where this is necessary, so how would I go about it short of writing my own Lock that has an explicit Release method I can call in the try catch's finally method.?