On 7/21/21 11:01 PM, frame wrote: > This is another parallel foreach body conversion question. > Isn't the compiler clever enough to put a synchronized block here?
parallel is a *function* (not a D feature). So, the compiler might have to analyze the entire code to suspect race conditions. No, D does not have such features.
But even if it did, we wouldn't want synchronized blocks in parallelization because a synchronized block would run a single thread at a time and nothing would be running in parallel anymore.
Ali