Fix resetting
This commit is contained in:
parent
99d90d2e0c
commit
cf68ff0ec1
1 changed files with 153 additions and 48 deletions
|
|
@ -131,6 +131,11 @@ export class Locks<T> {
|
|||
this.locked.delete(key);
|
||||
}
|
||||
}
|
||||
|
||||
public reset(): void {
|
||||
this.locked.clear();
|
||||
this.waiters.clear();
|
||||
}
|
||||
}
|
||||
|
||||
export class Lock {
|
||||
|
|
@ -143,4 +148,8 @@ export class Lock {
|
|||
public async withLock<R>(fn: () => R | Promise<R>): Promise<R> {
|
||||
return this.locks.withLock(true, fn);
|
||||
}
|
||||
|
||||
public reset(): void {
|
||||
this.locks.reset();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue