refactor: Null safe multilock

This commit is contained in:
Christian Pauly 2021-08-19 10:18:42 +02:00
parent 0cd73e846d
commit 4b9a2945f4
1 changed files with 2 additions and 3 deletions

View File

@ -1,4 +1,3 @@
// @dart=2.9
/*
* Famedly Matrix SDK
* Copyright (C) 2019, 2020, 2021 Famedly GmbH
@ -40,7 +39,7 @@ class MultiLock<T> {
if (_completers[key] != null) {
futures.add(() async {
while (_completers[key] != null) {
await _completers[key].future;
await _completers[key]!.future;
}
}());
}
@ -60,7 +59,7 @@ class MultiLock<T> {
// we just have to simply unlock all the completers
for (final key in uniqueKeys) {
if (_completers[key] != null) {
final completer = _completers[key];
final completer = _completers[key]!;
_completers.remove(key);
completer.complete();
}