mirror of
https://github.com/CharaChorder/DeviceManager.git
synced 2026-01-07 10:32:49 +00:00
fix: deadlock
This commit is contained in:
@@ -179,12 +179,16 @@ export class CharaDevice {
|
|||||||
}
|
}
|
||||||
result = await callback(send, read)
|
result = await callback(send, read)
|
||||||
} finally {
|
} finally {
|
||||||
|
delete this.lock
|
||||||
this.suspendDebounceId = setTimeout(() => {
|
this.suspendDebounceId = setTimeout(() => {
|
||||||
// cannot be locked here as all the code until clearTimeout is sync
|
// cannot be locked here as all the code until clearTimeout is sync
|
||||||
console.assert(this.lock === undefined)
|
console.assert(this.lock === undefined)
|
||||||
this.lock = this.suspend().then(() => true)
|
this.lock = this.suspend().then(() => {
|
||||||
|
delete this.lock
|
||||||
|
delete this.suspendDebounceId
|
||||||
|
return true
|
||||||
|
})
|
||||||
}, this.suspendDebounce) as any
|
}, this.suspendDebounce) as any
|
||||||
this.lock = undefined
|
|
||||||
resolve(result)
|
resolve(result)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user