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";
|
||||
|
||||
export class LockMap {
|
||||
private readonly _map: Map<unknown, Lock> = new Map();
|
||||
export class LockMap<T> {
|
||||
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);
|
||||
if (lock) {
|
||||
await lock.take();
|
||||
|
|
Reference in a new issue