Hi,
I have the following code.
while (foo) {
lock (bar) {
if (abc) {
break;
}
}
}
If I call the break statement, would the bar be unlocked?
Thanks.
Franz
Frisky - 08 Jul 2005 19:36 GMT
Yes.
lock (x) {
// ... your code here
}
is equivalent to:
Monitor.Enter(x);
try {
// ... your code here
}
finally {
Monitor.Exit(x);
}
Frisky
> Hi,
>
[quoted text clipped - 12 lines]
> Thanks.
> Franz