tryAcquire

abstract suspend fun tryAcquire(): P?

Tries to acquire a permit from this semaphore. This function is marked as a suspend function because it may perform I/O operations, but it won't suspend in case that no permit is available at the moment.

Return

permit if a permit was acquired and null otherwise.