forked from mystiq/hydrogen-web
Use generic T in LockMap
This commit is contained in:
parent
048547828d
commit
64a9892ee2
1 changed files with 3 additions and 3 deletions
|
@ -16,10 +16,10 @@ limitations under the License.
|
||||||
|
|
||||||
import {Lock} from "./Lock";
|
import {Lock} from "./Lock";
|
||||||
|
|
||||||
export class LockMap {
|
export class LockMap<T> {
|
||||||
private readonly _map: Map<unknown, Lock> = new Map();
|
private readonly _map: Map<T, Lock> = new Map();
|
||||||
|
|
||||||
async takeLock(key: unknown): Promise<Lock> {
|
async takeLock(key: T): Promise<Lock> {
|
||||||
let lock = this._map.get(key);
|
let lock = this._map.get(key);
|
||||||
if (lock) {
|
if (lock) {
|
||||||
await lock.take();
|
await lock.take();
|
||||||
|
|
Loading…
Reference in a new issue