eval

suspend fun <R> eval(block: T.() -> R): R

Suspends until a script instance can be borrowed, runs block on it, and returns the instance to the pool afterwards, even if block throws.

Return

the result of block

Parameters

block

the work to do with the borrowed instance

Throws

kotlinx.coroutines.channels.ClosedReceiveChannelException

if the pool has been closed