This item was deprecated in version 2020r2. Please use Semaphore as a replacement.
Used to coordinate access to a shared resource.
Constructors are special methods called when you create an object with the New keyword and pass in the parameters above.
Creates a semaphore with an initial count of resources to track.
Call Release to give a locked resource back to the Semaphore.
Call Signal to obtain a lock on a resource, blocking until it does. Once you are done with the shared resource, call Release to decrement the internal counter.
Every time a thread calls Signal, the Semaphore decrements the counter. If the counter is less than zero, it suspends the thread.
When you obtain a lock, you can use the resource. If the call succeeds, this function returns immediately and you code continues to execute. If the lock is not available, then the thread that called this method will wait until the lock becomes available. When you are finished using the resource, call the Release method to give it back to the Semaphore.
TrySignal As Boolean
Determines whether there is a lock available. If there is a lock available, you are granted the lock and TrySignal returns True. When you are finished with the resource, call Release to give it back to the Semaphore. If the lock is not available, it does not block. Instead, TrySignal returns False to let you know. Do not attempt to use the resource after it returns False because you are likely to collide with another thread.
All projects types on all supported operating systems.