withPermit

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

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.

Sources

common source
Link copied to clipboard