acquire method

Future<void> acquire()

Implementation

Future<void> acquire() {
  if (_permits > 0) {
    _permits--;
    return Future.value();
  } else {
    Completer<void> completer = Completer<void>();
    _waitQueue.add(completer);
    return completer.future;
  }
}