send method

Future<R?> send(
  1. IsolateTask<T, R> task
)

Implementation

Future<R?> send(IsolateTask<T, R> task) async {
  if (!_initialized) {
    throw StateError('Must run init() first before using pool.');
  }
  var worker = _workers[_random.nextInt(count)];

  while (worker.isTooBusy) {
    await Future<void>.delayed(const Duration(milliseconds: 10));
  }
  return worker.send(task);
}