CriticalSection.Enter

From Xojo Documentation

Revision as of 22:09, 30 January 2012 by Dbrandt (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Method

CriticalSection.Enter()

Supported for all project types and targets.

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

Notes

When the call to Enter succeeds, the function 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.