While loop on global variable optimised away?

ichneumwn idonotenjoyemail at idonotenjoyemail.org
Wed May 11 10:19:12 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.

Thank you, in C I would not have been surprised. It was the 
default thread local storage that made me question it. Your 
remark about the mutex lock/unlock is very helpful, I was 
starting to get worried I would need to keep a very careful watch 
on those __gshareds [well, more than usual :) ]



More information about the Digitalmars-d-learn mailing list