Block exception

Possible duplicate:
In C #, is a locked object locked if it has an exception?

What happens when you have code like this

lock(myLock) { try{ //some code }catch(SomeException e) { throw e; } } 

Will myLock be released correctly? I have a situation where this is necessary, so how can I do this if I do not write my own Lock, which has an explicit Release method, which I can call in the try catch finally method ??

+6
source share

Source: https://habr.com/ru/post/909454/


All Articles