Closed
Description
This is a very important note in allowing resource guards. Out of band cancellation allows for resources to affect the cancellation of a task. I have talked about this some in: tc39/proposal-async-await#27 . However, I will rephrase it here. The easiest example is lock files; given the following:
async function () {
try {
let lock = await getLock(__filename);
lock.oncompromised = cancel;
// tasks requiring the lock
}
finally {
// cleanup
}
}
It is important to allow the lock to cancel any tasks requiring it. By cancel I do not mean to rollback, but rather to stop execution of the next task and instead attempt to return (not throw). The alternative is to force every await to have a programmatic guard which is more error prone and requires knowledge of how to check if a resource is compromised.
Metadata
Metadata
Assignees
Labels
No labels