Files
UnrealEngineUWP/Engine/Source/Runtime/CoreUObject/Public
russell johnston b6235b6f2e Task cancellation in VerseVM
`(task:)Cancel` is now `<suspends>`. If the target task, or one of its descendents, is on the native stack (e.g. because it is, started, or resumed the current task, or because it was resumed from an `Await` or `Cancel` alongside such a task), the canceling task yields.

When an individual canceled task has no more children, its call stack is unwound. Rather than change the calling convention for `<suspends>` functions, unwinding control flow edges are encoded as a table in `VProcedure`. Unwinding finds the innermost `defer` block or task boundary by walking the stack, and `defer` blocks entered this way end with a new `ResumeUnwind` instruction.

Because cancellation interacts with the task parent/child relation, this change includes `branch` as a simple way to write tests. The remaining structured concurrency constructs will come in a future change.

Native `<suspends>` functions now return a new `FVerseResult` object rather than a bare `ECoroutineResult`. Today, this simplifies the mechanism for transmitting the return value. It was also originally intended as a way for native functions to initiate cancellation; this turned out to be unnecessary in the current implementation, but enables a future `CancelIfRequested` API.

#rb saam.barati, Tim.Smith
#okforversepublic

[CL 33307997 by russell johnston in ue5-main branch]
2024-04-29 14:18:33 -04:00
..
2024-04-28 22:05:44 -04:00
2024-04-29 14:18:33 -04:00