Currently, C# cancellation tokens just directly call the tokio task abort function when cancelled. Using the tokio-util crate, this can be made more robust using Cancellation Tokens. These offer a nice way to recover gracefully on the Rust side of the FFI interface, rather than the task being dropped at the next await synchronization point.
I've created a pull request that does a few things:
- Adds basic cancellation token support via
tokio_util::sync::CancellationToken. This is guarded behind the tokio-ct feature flag.
- Adds a basic asynchronous programming example to the production example project
(PR draft #281)
Currently, C# cancellation tokens just directly call the
tokiotask abort function when cancelled. Using thetokio-utilcrate, this can be made more robust using Cancellation Tokens. These offer a nice way to recover gracefully on the Rust side of the FFI interface, rather than the task being dropped at the nextawaitsynchronization point.I've created a pull request that does a few things:
tokio_util::sync::CancellationToken. This is guarded behind thetokio-ctfeature flag.(PR draft #281)