associative array with Parallel

Ali Çehreli acehreli at yahoo.com
Thu Jul 22 06:47:52 UTC 2021


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



More information about the Digitalmars-d-learn mailing list