withPermit

inline suspend fun <T> PrioritySemaphore.withPermit(priority: Double, block: () -> T): T

Acquire a permit at priority, run block, then release — the priority analogue of kotlinx.coroutines.sync.withPermit. Higher priority is served first when the pool is contended; equal priorities keep FIFO order.