Pages

Friday, May 4, 2012

Self Note: printfn output interleaving

Interesting enough, when doing the printfn in a multi-threading environment, you will see the output interleaving. This does not mean the printfn is not thread-safe. To comprise this, you need to use lock.

let syncRoot = ref 0
lock(syncRoot) ( fun _ ->  printfn "not interleaving printfn" )


No comments: