resize method

void resize(
  1. int max
)

Adjusts the maximum concurrency in place (omp's resize). Raising the ceiling immediately admits queued waiters that now fit; lowering it lets in-flight holders drain naturally.

Implementation

void resize(int max) {
  _max = max > 0 ? max : _unbounded;
  while (_current < _max && _queue.isNotEmpty) {
    final next = _queue.removeAt(0);
    _current++;
    next();
  }
}