Hi

i have an important question about the lock statement.

If i have
object objA;
object objB;

and then object
refObj = objA;
or
refObj = objB;

if i do
lock (refObj) { ... }

will it be considered like
lock(objA){ ... }
or
lock(objB){ ... }

or it will use regObj to lock (so the next call to lock(objA) or
lock(objB) will not block?

Re: lock statement by Jon

Jon
Thu Aug 19 11:49:29 CDT 2004

Gaetan <gaetan@xeberon.net> wrote:
> i have an important question about the lock statement.
>
> If i have
> object objA;
> object objB;
>
> and then object
> refObj = objA;
> or
> refObj = objB;
>
> if i do
> lock (refObj) { ... }
>
> will it be considered like
> lock(objA){ ... }
> or
> lock(objB){ ... }
>
> or it will use regObj to lock (so the next call to lock(objA) or
> lock(objB) will not block?

It's the object which is referred to which is important, not which
variable is used.

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too