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