OK to call return within a lock?

  • Thread starter Thread starter Earl Teigrob
  • Start date Start date
E

Earl Teigrob

If I set a lock within a function and then call a return within the lock,
will the lock on the object be released immediately?

Thanks

Earl
 
Hi Earl,

Yes, it will because the lock actually uses Monitor class and it calls
Monitor.Exit method in a finally block.
 

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