withInterpreter<T> method
Runs fn with exclusive access to one interpreter, selected round-robin.
Callers are serialized per slot, different slots can run concurrently.
Implementation
Future<T> withInterpreter<T>(
Future<T> Function(Interpreter, IsolateInterpreter?) fn,
) async {
final pool = _pool;
if (pool == null || pool.isEmpty) {
throw StateError('InterpreterPool is empty. Call initialize() first.');
}
return pool.withItem((slot) => fn(slot.$1, slot.$2));
}