acquire method

Future<void> acquire()
inherited

Acquire the lock. If the lock has already been acquired then this method will wait asynchronously until the lock is released.

Implementation

Future<void> acquire() async {
  if (!_locked && _waiters.isEmpty) {
    _locked = true;
    return;
  }

  var waiter = _FutureWaiter();
  _waiters.add(waiter);

  return waiter.future;
}