-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Labels
Description
Acquired locks are currently not reentrant...
navigator.locks.request('foo', async () => {
navigator.locks.request('foo', async () => {
// This will block...
})
})
If an exclusive lock is requested by the same context that already owns the lock, it would be nice to have the ability for that to just work...
navigator.locks.request('foo', { reentrant: true }, async () => {
navigator.locks.request('foo', async () => {
// This would succeed.
})
})
The above example is pretty silly, of course. The use case I'm considering are when the callback invoked comes from a different source, or some further down dependency is requesting the lock... e.g.
async function alsoHappensToRequestLock() {
await navigator.locks.request('foo', async () => {
// ...
})
}
navigator.locks.request('foo', { reentrant: true }, async () => {
await alsoHappensToRequestLock();
})
arogozhnikov