Fixing race issues the right way

solidstate1991 laszloszeremi at outlook.com
Sun Apr 5 22:24:27 UTC 2020


My game engine is currently broken due to some race issue I don't 
really know how to resolve.

It seems that the compiler tries to skip instructions that are 
not locked with a `writeln()` or something similar. Usually I can 
safely remove the writeln after compiling it once with that way. 
However I've once ran into an issue when a previously working 
code just started to emit random junk data depending on CPU 
usage, and in that case the aforementioned workaround only 
partially worked (delaying crashes, etc).

I've heard something about Mutex, however I lack the experience 
with multithreading.


More information about the Digitalmars-d-learn mailing list