static lock

  • Thread starter Thread starter Sharon
  • Start date Start date
S

Sharon

hi.
i have a static method which has a locked code block.
inside this lock i call other static utile methods in another class.
the utile methods do not hold any state.
i'm not sure what will happen when other threads will try to call these
utile methods.
will a utile method be locked as well when a thread from a locked block
enters?
thanks.
 
Sharon said:
i have a static method which has a locked code block.
inside this lock i call other static utile methods in another class.
the utile methods do not hold any state.
i'm not sure what will happen when other threads will try to call these
utile methods.
will a utile method be locked as well when a thread from a locked block
enters?

No. Unless the code goes through a lock itself, it won't block. (There
are exceptions involving type initialization etc, but I don't think
they're relevant to your question.)
 

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