From Xojo Documentation



Supported for all project types and targets.

Attempts to get a lock on the resource managed by the CriticalSection.


When the call to Enter succeeds, it returns and your code has exclusive access to the protected resource. 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.