CriticalSection.Enter Method

Attempts to get a lock on the resource managed by the CriticalSection. When the call to Enter succeeds, the function returns and your code has exclusive access to the protected resource.

Syntax

# Notes

If the lock cannot be obtained immediately, Enter will block the current thread from continuing to run. It will wait for the resource to become available.

Enter differs from the Signal method of the Semaphore class in that it can be called multiple times from the currently executing thread. If the calling thread already owns the lock, the method returns immediately. This makes CriticalSections very useful for calling a method recursively.