Lets! / I do! always run async object in new thread?

From wikibook to F # there is a small section that says:

What is he doing! do? #

let!starts the object async<'a>in its own thread , then it immediately frees the current thread back to threadpool. When it let!returns, the workflow will continue in a new thread, which may or may not be the same thread that started the workflow.

I have not found anywhere in books or on the Internet that speaks of this fact (in bold).

Is this true for all let!/ do!no matter what the async object contains (e.g. Thread.Sleep()) and how it starts (e.g. Async.Start)?

In the F # source code on github, I could not find the place where the binding call is made to a new (TP) thread. Where does the magic happen in the code?

+4
source share
2 answers

What part of this statement will you be surprised at? Is it possible that parts of the same asynchronous call can be executed in different threadpool threads, or that the threadpool thread is necessarily freed up and is received on each binding?

, - . , , threadpool ( , Async , queueAsync ), Async.SwitchToNewThread . , .

, , , - , Async . , , , , , .

+2

. , . , API.

. Cync ? . F # # , .

, F # async, .

+1

All Articles