While loop on global variable optimised away?

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Thu May 12 13:24:51 UTC 2022


On Wednesday, 11 May 2022 at 10:01:18 UTC, Johan wrote:
> Any function call (inside the loop) for which it cannot be 
> proven that it never modifies your memory variable will work. 
> That's why I'm pretty sure that mutex lock/unlock will work.

  I think the common semantics ought to be that everything written 
by thread A  before it releases the mutex will be visible to 
thread B when it aquires the same mutex, and any assumptions 
beyond this are nonportable?



More information about the Digitalmars-d-learn mailing list