lock statement

  • Thread starter Thread starter Gaetan
  • Start date Start date
G

Gaetan

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?
 
Gaetan said:
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.
 
Back
Top