A non-blocking counting semaphore.
Objects that implement this interface guarantee that all operations are atomic. Implementations do not have to guarantee that acquiring a lock is first-come, first serve.
Gets the number of currently available locks.
Gets the total number of locks on the semaphore (not the number of available locks).
Acquires a lock from the semaphore asynchronously.
If there are one or more locks available, this function resolves immediately with a lock and the lock count is decreased. If no locks are available, the semaphore waits asynchronously for a lock to become available.
Coroutine: Calls to this function must be preceded with
yield within another coroutine or wrapped with
new Coroutine() to create an awaitable.
- Lock object which can be used to release the acquired.