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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top