In a c# threading app, if I were to lock an object, let us say a queue, and if an exception occurs, will the object stay locked? Here is the pseudo-code:
in
Your lock will be released properly. A lock acts like this:
lock
try { Monitor.Enter(myLock); // ... } finally { Monitor.Exit(myLock); }
And finally blocks are guaranteed to execute, no matter how you leave the try block.
finally
try