Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Always use threadpool threads for continuations in async

Tags:

f#

Is there a way to instruct F# to always use threadpool threads for continuations in async computation expressions regardless of the synchronization context?

like image 744
kasperhj Avatar asked Sep 28 '22 05:09

kasperhj


1 Answers

Sure you use Async.SwitchToThreadPool or another Switch... method

like this:

async {

   do! Async.SwitchToThreadPool () 
   // ... your other stuff
}
like image 120
Random Dev Avatar answered Oct 05 '22 06:10

Random Dev