Acquires a permit from this semaphore, suspending until one is available. All suspending acquirers are processed in first-in-first-out (FIFO) order.
This suspending function is cancellable. If the Job of the current coroutine is cancelled or completed while this function is suspended, this function immediately resumes with CancellationException. There is a prompt cancellation guarantee. If the job was cancelled while this function was suspended, it will not resume successfully. See suspendCancellableCoroutine documentation for low-level details. This function releases the semaphore if it was already acquired by this function before the CancellationException was thrown.
Note, that this function does not check for cancellation when it does not suspend. Use CoroutineScope.isActive or CoroutineScope.ensureActive to periodically check for cancellation in tight loops if needed.
Use tryAcquire to try to acquire a permit of this semaphore without suspension.