withPermit

inline suspend fun <T> Semaphore.withPermit(action: () -> T): T(source)

Executes the given action, acquiring a permit from this semaphore at the beginning and releasing it after the action is completed.

Return

the return value of the action.