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.)
 
Back
Top