Question

Here we see a paper by Don Syme on Async state machines in F#. I'm trying to get my head around it.

My question is - does this do the same thing as the async command in C#? (and the go command in go-lang)

Was it helpful?

Solution

It's not exactly the same, no, but C# also uses state machines to build the async versions of methods on compilation.

See http://msdn.microsoft.com/en-us/magazine/hh456403.aspx for a great article by Mads Torgersen about how methods are rewritten in the compiler for C#'s async token.

In golang, goroutines are much more similar to the .Net TPL than the async token, conceptually. A goroutine is swapped out for another on a thread if it becomes blocking, so you're working with more of a thread pool construct. Go handles the non-blocking I/O for you under the hood.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top