release method

void release(
  1. K key
)

Release a lock.

Release a lock that has been acquired.

Implementation

void release(K key) {
  final lock = _rwMutexes[key];
  if (lock == null) {
    throw StateError(
        '`release` called for lock with key `$key`, when no lock to release.');
  }
  if (lock._waiting.isEmpty) {
    _rwMutexes.remove(key);
  } else {
    lock.release();
  }
}