Shared and race conditions

Michael michael at toohuman.io
Wed Nov 29 16:26:18 UTC 2017


On Wednesday, 29 November 2017 at 16:19:05 UTC, Michael wrote:
> On Wednesday, 29 November 2017 at 16:13:13 UTC, Wanderer wrote:
>> [...]
>
> I unfortunately cannot answer your question but I am noticing 
> that running the code with DMD gives you an unordered sequence 
> of IDs, but running with DMD-nightly gives you a sequence in 
> the correct order. I wonder what has changed to do with threads 
> that causes this difference between compiler versions.

Just to add to this, the page here:
https://tour.dlang.org/tour/en/multithreading/synchronization-sharing
does suggest that the compiler will automatically create critical 
sections when it can i.e. wrapping a section in

synchronized {
     importStuff();
}


More information about the Digitalmars-d-learn mailing list