exit sub in SyncLock

  • Thread starter Thread starter Perecli Manole
  • Start date Start date
P

Perecli Manole

Can an Exit Sub statement in a SyncLock block cause any problems with the
proper release of the locked resource or affect the Monitor's waiting queue
in any way?

Thanks
Perry
 
Perecli Manole said:
Can an Exit Sub statement in a SyncLock block cause any problems with the
proper release of the locked resource or affect the Monitor's waiting queue
in any way?

From the docs for SyncLock:

<quote>
Acquisition and Release. A SyncLock block behaves like a Try...Finally
construction in which the Try block acquires an exclusive lock on
lockobject and the Finally block releases it. Because of this, the
SyncLock block guarantees release of the lock, no matter how you exit
the block. This is true even in the case of an unhandled exception.
</quote>
 

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

Similar Threads


Back
Top