Task.halt() always succeeds as long as teardown succeeds. #837
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
There are two distinct ways in which a task can fail. It can straight up fail if there is an error during its execution, or it can fail after it has already completed its execution and somewhere in the teardown process an error occurs. So for example, a task whose execution succeeds but whose teardown fails will be considered a failure.
It is also possible to have a task whose execution fails, but whose teardown succeeds. However, we don't represent this when evaluating the
Task.halt()
operation. Instead, we always fail if the task execution has failed. This is a not ideal because if a user awaits or yields toTask.halt()
they haven't asked for the result of the task itself, only for the result of halting it. This makes meta-level apis like wait groups more difficult because you have to have separate logic for errored tasks and for successful tasks, when really in some cases, you want to treat them all as something that just needs to be halted.current behavior
desired behavior
Approach
Luckily, we are already tracking the success or failure of frame destruction internally, so this just adds that information to the
FrameResult
, so now with every frame, you can not only read both how its execution went (error, success, abort), but also how went its destruction.