Skip to content

Conversation

@isaacabraham
Copy link
Contributor

Improve Cancellation Token sample.

Summary

Having reviewed the Cancellation Token source example, I'm not sure it is currently a particularly good example:

  1. It doesn't do anything F# asynchronous inside it - it actually calls the "original" Async web client upload async, not the F# async version or even the C# Async / Await version. This is confusing, as it doesn't block and can't be let bound.
  2. The workflow returned immediately - there was no opportunity to see cancellation working in action.

I've replaced it with a simpler example that simpler prints to the console every 1 second. The cancellation token can be called, which will stop the workflow. This works very well from within a script.

Improve Cancellation Token sample
@isaacabraham isaacabraham changed the title Update async.md Improved async.md Cancellation Token example. Oct 20, 2018
Copy link
Contributor

@cartermp cartermp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @isaacabraham this is much better.

Slight simplification.
@Thraka
Copy link
Contributor

Thraka commented Oct 22, 2018

@isaacabraham Hi Isaac! Looks like something came through and caused a merge conflict. You'll need to fix this before we can merge. Thanks.

@mairaw
Copy link
Contributor

mairaw commented Dec 17, 2018

@isaacabraham @cartermp can one of you take a look at the merge conflicts and see which version of the code (or a mix of the two) you prefer to keep?

@isaacabraham
Copy link
Contributor Author

Oops - will do.

@isaacabraham
Copy link
Contributor Author

@mairaw fixed. @cartermp it should be ok now - it uses the second (simplified) version.

@cartermp cartermp merged commit a31ec27 into dotnet:master Dec 17, 2018
@isaacabraham isaacabraham deleted the patch-3 branch January 1, 2019 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants