Under the hood, the builder does not work at all. The compiler simply converts the calculation expression into a series of method calls in the builder, and then compiles it.
Therefore, the thread safety of the builder is entirely dependent on the thread safety of its methods - that is, the methods you write.
For example, the following code:
myBuilder { let! x = f() let! y = g(x) return x + y }
Will be converted to the following:
myBuilder.Bind( f(), fun x -> myBuilder.Bind( g(x), fun y -> myBuilder.Return( x + y ) ) )
(NOTE: the code above may not be accurate, but it conveys the essence)
source share