It's not a multiple lock, it's a single lock. The runtime is smart enough to
realize that the calling thread already owns a lock on the reference, so one
lock is ignored. I'm not sure which lock though - possibly the inner.
--
Regards,
Alvin Bruney - ASP.NET MVP
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @
www.lulu.com/owc, Amazon.com etc
"Grzegorz Kaczor" <grzegorz.kaczor (AT) cc (DOT) com.pl> wrote
Quote:
Hello,
is it a mistake to lock the same object more than once? That is:
lock (this) {
lock (this) {
...
}
}
Is the syntax correct? This seems to work...
Regards,
Grzegorz Kaczor |