Will the below code snippet write correctly to results
for all indexes of the range of iteration?
While there are multiple threads accessing the same object simultaneously; each thread is writing to a unique location in memory due to the indexing.
let results:NewType[] = Array.zeroCreate temp.Length
let mutable data = Unchecked.defaultof<OldType>
let loopResult =
System.Threading.Tasks.Parallel.For(
0,
temp.Length,
(fun i ->
data <- temp.[i]
results.[i] <- NewType(data.X, data.Y)
)
)