From the wikibook on F# there is a small section where it says:
What does let! do?#
let!
runs anasync<'a>
object on its own thread, then it immediately releases the current thread back to the threadpool. Whenlet!
returns, execution of the workflow will continue on the new thread, which may or may not be the same thread that the workflow started out on.
I have not found anywhere else in books or on the web where this fact (highlighted in bold) is stated.
Is this true for all let!
/do!
regardless of what the async object contains (e.g. Thread.Sleep()
) and how it is started (e.g. Async.Start
)?
Looking in the F# source code on github, I wasn't able to find the place where a call to bind executes on a new (TP) thread. Where in the code is the magic happening?